Class EsbClusterBus
java.lang.Object
com.kingsrook.qqq.esb.cluster.EsbClusterBus
- All Implemented Interfaces:
ClusterBusInterface,AutoCloseable
Cluster control events (core ClusterBus) over an ESB topic,
qqq.cluster.control: every node publishes and subscribes (non-durable,
non-shared, so each node gets each event; non-persistent with a 2 minute
time-to-live - a lost event is covered by cache TTLs). Configure with
ClusterBusMetaData.withBus(new QCodeReference(EsbClusterBus.class)). The
topic is declared automatically when the instance has a single ESB
provider; with several, declare it (type TOPIC) with its provider.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringthe topic every node publishes and subscribes to -
Constructor Summary
ConstructorsConstructorDescriptionCode-reference constructor, initialized with the owning instance in context.EsbClusterBus(QInstance instance) Resolve a declared topic, or the default topic on a single configured provider. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Interrupt setup before taking its lock; the owner retains provider connections.booleanReadiness is also useful for hosts starting an HTTP server after the bus.voidpublish(ClusterEvent message) Use a non-transacted, auto-ack session like the control topic.subscribe(Consumer<ClusterEvent> listener) Subscribe locally; the broker sends each message to every pod, including its producer.
-
Field Details
-
DESTINATION_NAME
the topic every node publishes and subscribes to- See Also:
-
-
Constructor Details
-
EsbClusterBus
public EsbClusterBus()Code-reference constructor, initialized with the owning instance in context. -
EsbClusterBus
Resolve a declared topic, or the default topic on a single configured provider.
-
-
Method Details
-
publish
Use a non-transacted, auto-ack session like the control topic. Never fail a caller.- Specified by:
publishin interfaceClusterBusInterface
-
subscribe
Subscribe locally; the broker sends each message to every pod, including its producer.- Specified by:
subscribein interfaceClusterBusInterface
-
isListening
public boolean isListening()Readiness is also useful for hosts starting an HTTP server after the bus. -
close
public void close()Interrupt setup before taking its lock; the owner retains provider connections.- Specified by:
closein interfaceAutoCloseable
-