com.r3corda.node.services.messaging / NodeMessagingClient / <init>

# <init>

`NodeMessagingClient(config: NodeConfiguration, serverHostPort: <ERROR CLASS>, myIdentity: PublicKey?, executor: AffinityExecutor, persistentInbox: Boolean = true, persistenceTx: (() -> Unit) -> Unit = { it() })`

This class implements the MessagingService API using Apache Artemis, the successor to their ActiveMQ product. Artemis is a message queue broker and here we run a client connecting to the specified broker instance ArtemisMessagingServer. Its primarily concerned with peer-to-peer messaging.

Message handlers are run on the provided AffinityExecutor synchronously, that is, the Artemis callback threads are blocked until the handler is scheduled and completed. This allows backpressure to propagate from the given executor through into Artemis and from there, back through to senders.

An implementation of CordaRPCOps can be provided. If given, clients using the CordaMQClient RPC library can invoke methods on the provided implementation. There is more documentation on this in the docsite and the CordaRPCClient class.

### Parameters

`serverHostPort` - The address of the broker instance to connect to (might be running in the same process)
`myIdentity` - Either the public key to be used as the ArtemisMQ address and queue name for the node globally, or null to indicate that this is a NetworkMapService node which will be bound globally to the name "networkmap"
`executor` - An executor to run received message tasks upon.
`persistentInbox` - If true the inbox will be created persistent if not already created. If false the inbox queue will be transient, which is appropriate for UI clients for example.
`persistenceTx` - A lambda to wrap message processing in any transaction required by the persistence layer (e.g. a database transaction) without introducing a dependency on the actual solution and any parameters it requires in this class.