org.pipservices4.messaging.queues.IMessageReceiver 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.queues;
/**
* Callback interface to receive incoming messages.
*
* ### Example ###
*
* {@code
* class MyMessageReceiver implements IMessageReceiver {
* public void receiveMessage(MessageEnvelope envelop, IMessageQueue queue) {
* System.out.println("Received message: " + envelop.getMessageAsString());
* ...
* }
* }
*
* MemoryMessageQueue messageQueue = new MemoryMessageQueue();
* messageQueue.listen("123", new MyMessageReceiver());
*
* messageQueue.open("123");
* messageQueue.send("123", new MessageEnvelope(null, "mymessage", "ABC")); // Output in console: "ABC"
* }
*
*/
public interface IMessageReceiver {
/**
* Receives incoming message from the queue.
*
* @param message an incoming message
* @param queue a queue where the message comes from
*
* @see MessageEnvelope
* @see IMessageQueue
*/
void receiveMessage(MessageEnvelope message, IMessageQueue queue);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy