core.messaging

Package core.messaging

Types

AllPossibleRecipients interface AllPossibleRecipients : MessageRecipients

A special base class for the set of all possible recipients, without having to identify who they all are.

LegallyIdentifiableNode data class LegallyIdentifiableNode

Info about a network node that has is operated by some sort of verified identity.

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.

MessagingServiceBuilder interface MessagingServiceBuilder<out T : MessagingService>

This class lets you start up a MessagingService. Its purpose is to stop you from getting access to the methods on the messaging service interface until you have successfully started up the system. One of these objects should be the only way to obtain a reference to a MessagingService. Startup may be a slow process: some implementations may let you cast the returned future to an object that lets you get status info.

MockNetworkMapService class MockNetworkMapService : NetworkMapService
NetworkMapService interface NetworkMapService

A network map contains lists of nodes on the network along with information about their identity keys, services they provide and host names or IP addresses where they can be connected to. A reasonable architecture for the network map service might be one like the Tor directory authorities, where several nodes linked by RAFT or Paxos elect a leader and that leader distributes signed documents describing the network layout. Those documents can then be cached by every node and thus a network map can be retrieved given only a single successful peer connection.

SingleMessageRecipient interface SingleMessageRecipient : MessageRecipients

A base class for the case of point-to-point messages

StateMachineManager class StateMachineManager

A StateMachineManager is responsible for coordination and persistence of multiple ProtocolStateMachine objects. Each such object represents an instantiation of a (two-party) protocol that has reached a particular point.

TopicStringValidator object TopicStringValidator

A singleton thats useful for validating topic strings

Functions

runOnNextMessage fun MessagingService.runOnNextMessage(topic: String = "", executor: Executor? = null, callback: (Message) -> Unit): Unit

Registers a handler for the given topic 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, to: MessageRecipients, obj: Any, includeClassName: Boolean = false): Unit