All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.pipservices4.messaging.build.DefaultMessagingFactory Maven / Gradle / Ivy

The newest version!
package org.pipservices4.messaging.build;

import org.pipservices4.components.refer.Descriptor;
import org.pipservices4.components.build.Factory;
import org.pipservices4.messaging.queues.MemoryMessageQueue;

/**
 * Creates {@link MemoryMessageQueue} components by their descriptors.
 * Name of created message queue is taken from its descriptor.
 *
 * @see Factory
 * @see MemoryMessageQueue
 */
public class DefaultMessagingFactory extends Factory {

    private static final Descriptor MemoryQueueDescriptor = new Descriptor("pip-services", "message-queue", "memory", "*", "1.0");
    private static final Descriptor MemoryQueueFactoryDescriptor = new Descriptor("pip-services", "queue-factory", "memory", "*", "1.0");

    /**
     * Create a new instance of the factory.
     */
    public DefaultMessagingFactory() {
        super();
        registerAsType(MemoryQueueFactoryDescriptor, MemoryMessageQueueFactory.class);
        register(MemoryQueueDescriptor, (locator) -> {
            Descriptor descriptor = (Descriptor) locator;
            return new MemoryMessageQueue(descriptor.getName());
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy