public class MessagingKt
Modifier and Type | Method and Description |
---|---|
static Message |
createMessage(MessagingService $receiver,
java.lang.String topic,
long sessionID,
byte[] data)
Returns an initialised
interface Message with the current time, etc, already filled in. |
static <M> com.google.common.util.concurrent.ListenableFuture<M> |
onNext(MessagingService $receiver,
java.lang.String topic,
long sessionId)
Returns a ListenableFuture of the next message payload (Message.data) which is received on the given topic and sessionId.
The payload is deserialized to an object of type M. Any exceptions thrown will be captured by the future.
|
static void |
runOnNextMessage(MessagingService $receiver,
java.lang.String topic,
long sessionID,
kotlin.jvm.functions.Function1<? super net.corda.core.messaging.ReceivedMessage,kotlin.Unit> callback)
Registers a handler for the given topic and session ID that runs the given callback with the message and then removes
itself. This is useful for one-shot handlers that aren't supposed to stick around permanently. Note that this callback
doesn't take the registration object, unlike the callback to MessagingService.addMessageHandler, as the handler is
automatically deregistered before the callback runs.
|
static void |
runOnNextMessage(MessagingService $receiver,
TopicSession topicSession,
kotlin.jvm.functions.Function1<? super net.corda.core.messaging.ReceivedMessage,kotlin.Unit> callback)
Registers a handler for the given topic and session that runs the given callback with the message and then removes
itself. This is useful for one-shot handlers that aren't supposed to stick around permanently. Note that this callback
doesn't take the registration object, unlike the callback to MessagingService.addMessageHandler.
|
static void |
send(MessagingService $receiver,
java.lang.String topic,
long sessionID,
java.lang.Object payload,
MessageRecipients to,
java.util.UUID uuid) |
static void |
send(MessagingService $receiver,
TopicSession topicSession,
java.lang.Object payload,
MessageRecipients to,
java.util.UUID uuid) |
public static Message createMessage(MessagingService $receiver, java.lang.String topic, long sessionID, byte[] data)
Returns an initialised interface Message
with the current time, etc, already filled in.
topic
- identifier for the general subject of the message, for example "platform.network_map.fetch".
Must not be blank.sessionID
- identifier for the session the message is part of. For messages sent to services before the
construction of a session, use DEFAULT_SESSION_ID.interface Message
public static void runOnNextMessage(MessagingService $receiver, java.lang.String topic, long sessionID, kotlin.jvm.functions.Function1<? super net.corda.core.messaging.ReceivedMessage,kotlin.Unit> callback)
Registers a handler for the given topic and session ID that runs the given callback with the message and then removes itself. This is useful for one-shot handlers that aren't supposed to stick around permanently. Note that this callback doesn't take the registration object, unlike the callback to MessagingService.addMessageHandler, as the handler is automatically deregistered before the callback runs.
topic
- identifier for the general subject of the message, for example "platform.network_map.fetch".
The topic can be the empty string to match all messages (session ID must be DEFAULT_SESSION_ID).sessionID
- identifier for the session the message is part of. For services listening before
a session is established, use DEFAULT_SESSION_ID.public static void runOnNextMessage(MessagingService $receiver, TopicSession topicSession, kotlin.jvm.functions.Function1<? super net.corda.core.messaging.ReceivedMessage,kotlin.Unit> callback)
Registers a handler for the given topic and session that runs the given callback with the message and then removes itself. This is useful for one-shot handlers that aren't supposed to stick around permanently. Note that this callback doesn't take the registration object, unlike the callback to MessagingService.addMessageHandler.
topicSession
- identifier for the topic and session to listen for messages arriving on.public static <M> com.google.common.util.concurrent.ListenableFuture<M> onNext(MessagingService $receiver, java.lang.String topic, long sessionId)
Returns a ListenableFuture of the next message payload (Message.data) which is received on the given topic and sessionId. The payload is deserialized to an object of type M. Any exceptions thrown will be captured by the future.
public static void send(MessagingService $receiver, java.lang.String topic, long sessionID, java.lang.Object payload, MessageRecipients to, java.util.UUID uuid)
public static void send(MessagingService $receiver, TopicSession topicSession, java.lang.Object payload, MessageRecipients to, java.util.UUID uuid)