net.corda.core.messaging

## Package net.corda.core.messaging

### Types

Ack | `object Ack : DeserializeAsKotlinObjectDef` A general Ack message that conveys no content other than its presence for use when you want an acknowledgement from a recipient. Using Unit can be ambiguous as it is similar to Void and so could mean no response.
AllPossibleRecipients | `interface AllPossibleRecipients : MessageRecipients` A special base class for the set of all possible recipients, without having to identify who they all are.
Message | `interface Message` A message is defined, at this level, to be a (topic, timestamp, byte arrays) triple, where the topic is a string in Java-style reverse dns form, with "platform." being a prefix reserved by the platform for its own use. Vendor specific messages can be defined, but use your domain name as the prefix e.g. "uk.co.bigbank.messages.SomeMessage".
MessageHandlerRegistration | `interface MessageHandlerRegistration`
MessageRecipientGroup | `interface MessageRecipientGroup : MessageRecipients` A base class for a set of recipients specifically identified by the sender.
MessageRecipients | `interface MessageRecipients` The interface for a group of message recipients (which may contain only one recipient)
MessagingService | `interface MessagingService` A MessagingService sits at the boundary between a message routing / networking layer and the core platform code.
SingleMessageRecipient | `interface SingleMessageRecipient : MessageRecipients` A base class for the case of point-to-point messages
TopicSession | `data class TopicSession` An identifier for the endpoint MessagingService message handlers listen at.
TopicStringValidator | `object TopicStringValidator` A singleton thats useful for validating topic strings

### Functions

createMessage | `fun MessagingService.createMessage(topic: String, sessionID: Long = DEFAULT_SESSION_ID, data: ByteArray): Message` Returns an initialised Message with the current time, etc, already filled in.
onNext | `fun <M : Any> MessagingService.onNext(topic: String, sessionId: Long): <ERROR CLASS><M>` Returns a ListenableFuture of the next message payload (Message.data) which is received on the given topic and sessionId. The payload is deserilaized to an object of type M. Any exceptions thrown will be captured by the future.
runOnNextMessage | `fun MessagingService.runOnNextMessage(topic: String, sessionID: Long, callback: (Message) -> Unit): Unit` 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 arent supposed to stick around permanently. Note that this callback doesnt take the registration object, unlike the callback to MessagingService.addMessageHandler, as the handler is automatically deregistered before the callback runs. `fun MessagingService.runOnNextMessage(topicSession: TopicSession, callback: (Message) -> Unit): Unit` 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 arent supposed to stick around permanently. Note that this callback doesnt take the registration object, unlike the callback to MessagingService.addMessageHandler.
send | `fun MessagingService.send(topic: String, sessionID: Long, payload: Any, to: MessageRecipients, uuid: UUID = UUID.randomUUID()): Unit` `fun MessagingService.send(topicSession: TopicSession, payload: Any, to: MessageRecipients, uuid: UUID = UUID.randomUUID()): Unit`