Package app.ductape.sdk.brokers
Class BrokersService
java.lang.Object
app.ductape.sdk.brokers.BrokersService
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBrokersService(EnvType env, RequestContext auth) BrokersService(RequestContext auth) BrokersService(RequestContext auth, ProductsService productsService, ProcessorApiService processorApiService) BrokersService(RequestContext auth, ProductsService productsService, ProcessorApiService processorApiService, LogApiService logApiService) -
Method Summary
Modifier and TypeMethodDescriptionauth()checkIdempotency(Map<String, Object> options) static voidVisible for tests / lifecycle hooks: clear the workspace-scoped shared provider pool.voidTSdisconnectAll: best-effort disconnect on all pooled providers.getBrokers(String productTag) getEventStats(Map<String, Object> options) publishIdempotent(Map<String, Object> options) replayEvent(Map<String, Object> options) reprocessDLQ(Map<String, Object> options) voidTSloadBrokerServiceparity: substitute the in-process broker provider factory.voidsetCacheManager(CacheManager cacheManager) TSbrokers.service.ts: optionalCacheManagerfor publish idempotency whencacheis set.voidsetSecretResolver(Function<String, String> secretResolver) TSgetSecretsService(): resolve broker config secrets prefixed withsecret://....TSbrokers.service.ts#subscribeparity entry point.subscribe(Map<String, Object> options, BrokerTypes.MessageCallback callback) Typed in-process overload: equivalent to TSbrokers.subscribe({ ..., callback })wherecallbackis the user message handler.testConnection(Map<String, Object> options)
-
Field Details
-
messages
-
-
Constructor Details
-
BrokersService
-
BrokersService
-
BrokersService
public BrokersService(RequestContext auth, ProductsService productsService, ProcessorApiService processorApiService) -
BrokersService
public BrokersService(RequestContext auth, ProductsService productsService, ProcessorApiService processorApiService, LogApiService logApiService)
-
-
Method Details
-
auth
-
setCacheManager
TSbrokers.service.ts: optionalCacheManagerfor publish idempotency whencacheis set. -
setBrokerServiceFactory
TSloadBrokerServiceparity: substitute the in-process broker provider factory. Defaults toProviderFactory.create(app.ductape.sdk.brokers.types.BrokerTypes.MessageBrokerType, java.util.Map<java.lang.String, java.lang.Object>). Tests inject a fake to avoid live Kafka/RabbitMQ/etc. -
setSecretResolver
TSgetSecretsService(): resolve broker config secrets prefixed withsecret://.... Pass a function that maps secret reference to plaintext. -
publish
-
subscribe
TSbrokers.service.ts#subscribeparity entry point.Dispatches between two paths based on whether the caller supplied a
BrokerTypes.MessageCallback:- In-process (TS-equivalent): when
options.callbackis aMessageCallback(or when the typed overloadsubscribe(Map, MessageCallback)is used), the SDK resolves the broker provider locally viaBrokerServiceFactory, wraps the user callback with TS-shape tracking (init/success logs + per-messageregisterBrokerConsumer/updateBrokerConsumerStatusfire-and-forget calls), and invokesprovider.subscribe(topicUrl, wrappedCallback)directly. - Processor-side: when no callback is provided, falls back to the existing
processorApiService.processProduct(...)dispatch, which is what server-mediated consumers use today.
- In-process (TS-equivalent): when
-
subscribe
public Map<String,Object> subscribe(Map<String, Object> options, BrokerTypes.MessageCallback callback) Typed in-process overload: equivalent to TSbrokers.subscribe({ ..., callback })wherecallbackis the user message handler. UsesBrokerServiceFactoryto obtain the provider (e.g. Kafka/RabbitMQ/SQS/PubSub/Redis/Nats) and wires a wrapped callback that mirrors TS message-id extraction, fire-and-forget tracking, and re-throw semantics so the underlying provider can nack/retry. -
disconnectAll
public void disconnectAll()TSdisconnectAll: best-effort disconnect on all pooled providers. -
testConnection
-
getBrokers
-
getBroker
-
getTopics
-
getTopic
-
getEvents
-
getEvent
-
replayEvent
-
getEventStats
-
reprocessDLQ
-
checkIdempotency
-
publishIdempotent
-