core.node.services / AbstractNodeService

# AbstractNodeService

`abstract class AbstractNodeService`

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

### Constructors

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

### Properties

net | `val net: MessagingService`

### Functions

addMessageHandler

`fun <Q : AbstractRequestMessage, R : Any> addMessageHandler(topic: String, handler: (Q) -> R, exceptionConsumer: (Message, Exception) -> Unit): Unit`

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.

`fun <Q : AbstractRequestMessage, R : Any> addMessageHandler(topic: String, handler: (Q) -> R): Unit`

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.

### Inheritors

DataVendingService | `class DataVendingService : AbstractNodeService` This class sets up network message handlers for requests from peers for data keyed by hash. It is a piece of simple glue that sits between the network layer and the database layer.
InMemoryNetworkMapService | `class InMemoryNetworkMapService : NetworkMapService, AbstractNodeService`
NodeTimestamperService | `class NodeTimestamperService : AbstractNodeService` This class implements the server side of the timestamping protocol, using the local clock. A future version might add features like checking against other NTP servers to make sure the clock hasnt drifted by too much.
Service | `class Service : AcceptsFileUpload, AbstractNodeService` The Service that wraps Oracle and handles messages/network interaction/request scrubbing.