public static DistributionQueueItem fromPackage()

in src/main/java/org/apache/sling/distribution/journal/queue/QueueItemFactory.java [63:88]


    public static DistributionQueueItem fromPackage(
            MessageInfo info, 
            PackageMessage message,
            boolean addMessage) {

        String packageId = message.getPkgId();
        long pkgLength = message.getPkgLength();
        Map<String, Object> properties = new HashMap<>(10);
        properties.put(RECORD_TOPIC, info.getTopic());
        properties.put(RECORD_PARTITION, info.getPartition());
        properties.put(RECORD_OFFSET, info.getOffset());
        properties.put(RECORD_TIMESTAMP, info.getCreateTime());
        properties.put(PROPERTY_PACKAGE_TYPE, message.getPkgType());
        properties.put(PROPERTY_REQUEST_TYPE, toDistReqType(message.getReqType()));
        String[] paths = toArray(message.getPaths());
        properties.put(PROPERTY_REQUEST_PATHS, paths);
        String[] deepPaths = toArray(message.getDeepPaths());
        properties.put(PROPERTY_REQUEST_DEEP_PATHS, deepPaths);
        if (addMessage) {
            properties.put(PACKAGE_MSG, message);
        }
        if (message.getUserId() != null) {
            properties.put(REQUEST_USER_ID, message.getUserId());
        }
        return new DistributionQueueItem(packageId, pkgLength, properties);
    }