net.corda.node.services.events / NodeSchedulerService

# NodeSchedulerService

`class NodeSchedulerService : SchedulerService, SingletonSerializeAsToken`

A first pass of a simple SchedulerService that works with MutableClocks for testing, demonstrations and simulations that also encompasses the Vault observer for processing transactions.

This will observe transactions as they are stored and schedule and unschedule activities based on the States consumed or produced.

Currently does not provide any system state other than the ContractState so the expectation is that a transaction is the outcome of the activity in order to schedule another activity. Once we have implemented more persistence in the nodes, maybe we can consider multiple activities and whether the activities have been completed or not, but that starts to sound a lot like off-ledger state.

### Parameters

`services` - Core node services.
`protocolLogicRefFactory` - Factory for restoring ProtocolLogic instances from references.
`schedulerTimerExecutor` - The executor the scheduler blocks on waiting for the clock to advance to the next activity. Only replace this for unit testing purposes. This is not the executor the ProtocolLogic is launched on.

### Types

RunScheduled | `class RunScheduled : ProtocolLogic<Unit>`

### Constructors

<init> | `NodeSchedulerService(database: <ERROR CLASS>, services: ServiceHubInternal, protocolLogicRefFactory: ProtocolLogicRefFactory, schedulerTimerExecutor: Executor = Executors.newSingleThreadExecutor())` A first pass of a simple SchedulerService that works with MutableClocks for testing, demonstrations and simulations that also encompasses the Vault observer for processing transactions.

### Functions

scheduleStateActivity | `fun scheduleStateActivity(action: ScheduledStateRef): Unit` Schedule a new activity for a TX output, probably because it was just produced.
start | `fun start(): Unit`
unscheduleStateActivity | `fun unscheduleStateActivity(ref: StateRef): Unit` Unschedule all activity for a TX output, probably because it was consumed.

### Inherited Functions

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