org.pipservices4.messaging.build.MemoryMessageQueueFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pip-services4-messaging Show documentation
Show all versions of pip-services4-messaging Show documentation
Messaging components for Pip.Services in Java
The newest version!
package org.pipservices4.messaging.build;
import org.pipservices4.components.refer.Descriptor;
import org.pipservices4.components.refer.ReferenceException;
import org.pipservices4.messaging.queues.IMessageQueue;
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 MemoryMessageQueueFactory extends MessageQueueFactory {
private static final Descriptor MemoryQueueDescriptor = new Descriptor("pip-services", "message-queue", "memory", "*", "1.0");
/**
* Create a new instance of the factory.
*/
public MemoryMessageQueueFactory() {
register(MemoryQueueDescriptor, (locator) -> {
Descriptor descriptor = (Descriptor) locator;
return new MemoryMessageQueue(descriptor.getName());
});
}
/**
* Creates a message queue component and assigns its name.
*
* @param name a name of the created message queue.
*/
@Override
public IMessageQueue createQueue(String name) throws ReferenceException {
var queue = new MemoryMessageQueue(name);
if (this._config != null)
queue.configure(this._config);
if (this._references != null)
queue.setReferences(this._references);
return queue;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy