corda / net.corda.node.services.api / AbstractNodeService

# AbstractNodeService

`@ThreadSafe abstract class AbstractNodeService : SingletonSerializeAsToken`

Abstract superclass for services that a node can host, which provides helper functions.

### Constructors

<init> | `AbstractNodeService(services: ServiceHubInternal)` Abstract superclass for services that a node can host, which provides helper functions.

### Properties

net | `val net: MessagingServiceInternal`
services | `val services: ServiceHubInternal`

### Functions

addMessageHandler | `fun <Q : ServiceRequestMessage, R : Any> addMessageHandler(topic: String, handler: (Q) -> R, exceptionConsumer: (Message, Exception) -> Unit): MessageHandlerRegistration` Register a handler for a message topic. In comparison to using net.addMessageHandler() this manages a lot of common boilerplate code. Exceptions are caught and passed to the provided consumer. If you just want a simple acknowledgement response with no content, use Ack. `fun <Q : ServiceRequestMessage, R : Any> addMessageHandler(topic: String, handler: (Q) -> R): MessageHandlerRegistration` Register a handler for a message topic. In comparison to using net.addMessageHandler() this manages a lot of common boilerplate code. Exceptions are propagated to the messaging layer. If you just want a simple acknowledgement response with no content, use Ack.

### Inherited Functions

toToken | `open fun toToken(context: SerializeAsTokenContext): SerializationToken`

### Inheritors

AbstractNetworkMapService | `abstract class AbstractNetworkMapService : NetworkMapService, AbstractNodeService` Abstracted out core functionality as the basis for a persistent implementation, as well as existing in-memory implementation.