Interface PartitionMessagingService
- All Known Implementing Classes:
AtomixPartitionMessagingService
public interface PartitionMessagingService
Abstracts away messaging to other members of a partition - add operations as needed.
-
Method Summary
Modifier and TypeMethodDescriptionvoidbroadcast(String subject, ByteBuffer payload) Broadcasts the given payload to all other members of the partition; should log if a member is not subscribed to a given topic, but not fail.voidsubscribe(String subject, Consumer<ByteBuffer> consumer, Executor executor) Subscribes to a given subject - if another member of the partition sends a message on this topic, the consumer will be notified with the given payload.voidunsubscribe(String subject) Unsubcribes from the given subject, such that no messages after this call are handled by any previously registered consumer.
-
Method Details
-
subscribe
Subscribes to a given subject - if another member of the partition sends a message on this topic, the consumer will be notified with the given payload. Each call is considered a new subscription.- Parameters:
subject- the subject to subscribe toconsumer- the consumer which handles the payloadexecutor- the executor on which the consumer is called
-
broadcast
Broadcasts the given payload to all other members of the partition; should log if a member is not subscribed to a given topic, but not fail.- Parameters:
subject- the subject on which to broadcast the payloadpayload- the payload to send
-
unsubscribe
Unsubcribes from the given subject, such that no messages after this call are handled by any previously registered consumer. If none registered, does nothing.- Parameters:
subject- the subject from which to unsubscribe
-