Package io.aeron.driver
Class IpcPublication
java.lang.Object
io.aeron.driver.IpcPublication
- All Implemented Interfaces:
DriverManagedResource
,Subscribable
Encapsulation of a stream used directly between publishers and subscribers for IPC over shared memory.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addSubscriber
(SubscriptionLink subscriptionLink, ReadablePosition subscriberPosition, long nowNs) Add a subscriber and its position used for tracking consumption.channel()
Channel URI string for this publication.void
close()
Close resources that are not external.boolean
free()
Free external resources such as files.boolean
Has resource reached end of its life and should be reclaimed?void
onTimeEvent
(long timeNs, long timeMs, DriverConductor conductor) Inform resource of timeNs passing and pass it DriverConductor to inform of any state transitions.void
removeSubscriber
(SubscriptionLink subscriptionLink, ReadablePosition subscriberPosition) Remove a subscriber and its position used for tracking consumption.int
Session id allocated to this stream.int
streamId()
Stream id within the channel.long
Registration ID that is in use by the subscribable.
-
Method Details
-
channel
Channel URI string for this publication.- Returns:
- channel URI string for this publication.
-
sessionId
public int sessionId()Session id allocated to this stream.- Returns:
- session id allocated to this stream.
-
streamId
public int streamId()Stream id within the channel.- Returns:
- stream id within the channel.
-
subscribableRegistrationId
public long subscribableRegistrationId()Registration ID that is in use by the subscribable.- Specified by:
subscribableRegistrationId
in interfaceSubscribable
- Returns:
- registration ID for subscribable.
-
free
public boolean free()Free external resources such as files. If successful then return true.- Specified by:
free
in interfaceDriverManagedResource
- Returns:
- true if successful and false if it should be attempted again later.
-
close
public void close()Close resources that are not external. This will not callDriverManagedResource.free()
. That will need to be called separately at the appropriate time.- Specified by:
close
in interfaceDriverManagedResource
-
addSubscriber
public void addSubscriber(SubscriptionLink subscriptionLink, ReadablePosition subscriberPosition, long nowNs) Add a subscriber and its position used for tracking consumption.- Specified by:
addSubscriber
in interfaceSubscribable
- Parameters:
subscriptionLink
- for identifying the subscriber.subscriberPosition
- for tracking the subscriber.nowNs
- for the current time.
-
removeSubscriber
public void removeSubscriber(SubscriptionLink subscriptionLink, ReadablePosition subscriberPosition) Remove a subscriber and its position used for tracking consumption.Note: The
Subscribable
is responsible for callingReadablePosition.close()
on removed positions.- Specified by:
removeSubscriber
in interfaceSubscribable
- Parameters:
subscriptionLink
- for identifying the subscriber.subscriberPosition
- for tracking the subscriber.
-
onTimeEvent
Inform resource of timeNs passing and pass it DriverConductor to inform of any state transitions.- Specified by:
onTimeEvent
in interfaceDriverManagedResource
- Parameters:
timeNs
- now in nanoseconds.timeMs
- now in milliseconds for epoch.conductor
- to inform of any state transitions.
-
hasReachedEndOfLife
public boolean hasReachedEndOfLife()Has resource reached end of its life and should be reclaimed?- Specified by:
hasReachedEndOfLife
in interfaceDriverManagedResource
- Returns:
- whether resource has reached end of life or not.
-