Package org.flasby.bus
Class PageBus
java.lang.Object
org.flasby.bus.PageBus
delivers publications to subscribers using a dotted addressing scheme.
Delivery is made in a separate thread so is asynchronous.
Publications can be overtaken by later ones with the same subject if the
earlier publication was marked as VOLATILE. This can be used to prevent out
of date messages from being delivered.
A typical application of this would be a price tick. The price has changed so there is often no point in delivering the out of date price.
In flight messages are not cancelled if a replacement arrives, only publications still waiting to be delivered. The new publication is always added to the end of the delivery queue.
- Author:
- Steve Flasby Jul 24, 2012
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static interface
static final class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PageBus
void
publish
(String subject, Object publication, PageBus.MessageVolatility isVolatile) publish something on the bus.subscribe
(String address, PageBus.Subscriber delivery) void
unsubscribe
(PageBus.Subscription subscription)
-
Field Details
-
STARTING
- See Also:
-
STOPPING
- See Also:
-
-
Constructor Details
-
PageBus
public PageBus()
-
-
Method Details
-
getGlobalInstance
-
publish
publish something on the bus.- Parameters:
subject
- the subject of the publication structured using a dotted notation.publication
- the thing being published.isVolatile
- if VOLATILE then this publication can be deleted from the delivery queue if another publication with an identical subject is published which is also VOLATILE.
-
subscribe
-
unsubscribe
-