ServiceBuilder
Defined in: packages/hoppity/src/ServiceBuilder.ts:79
The contract-driven service builder.
Built by hoppity.service(), supports .use(middleware) chaining and .build() to produce a wired ServiceBroker.
Build phases when .build() is called:
- Derive topology from handlers + publishes
- Merge with optional raw topology (raw is base, derived layers on top)
- Run middleware pipeline (they see the complete topology)
- Create Rascal broker via BrokerAsPromised.create()
- Wire event/command/rpc handlers (subscribe to queues, wrap with interceptors)
- Wire outbound methods (publishEvent, sendCommand, request, cancelRequest — wrap with interceptors)
- Run middleware onBrokerCreated callbacks (they see the fully-wired broker)
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ServiceBuilder(
serviceName,config):ServiceBuilder
Defined in: packages/hoppity/src/ServiceBuilder.ts:90
Parameters
Section titled “Parameters”serviceName
Section titled “serviceName”string
config
Section titled “config”Returns
Section titled “Returns”ServiceBuilder
Methods
Section titled “Methods”build()
Section titled “build()”build():
Promise<ServiceBroker>
Defined in: packages/hoppity/src/ServiceBuilder.ts:116
Builds the service broker by executing all phases in order.
Returns
Section titled “Returns”Promise<ServiceBroker>
use(
middleware):ServiceBuilder
Defined in: packages/hoppity/src/ServiceBuilder.ts:108
Adds middleware to the pipeline.
Parameters
Section titled “Parameters”middleware
Section titled “middleware”Returns
Section titled “Returns”ServiceBuilder