Class DataPacketDispatcher

java.lang.Object
io.aeron.driver.DataPacketDispatcher

public final class DataPacketDispatcher extends Object
Handling of dispatching data packets to PublicationImages streams.

All methods should be called from the Receiver thread.

  • Method Details

    • addSubscription

      public void addSubscription(int streamId)
      Add a subscription to a channel for a given stream id and wildcard session id.
      Parameters:
      streamId - to capture within a channel.
    • addSubscription

      public void addSubscription(int streamId, int sessionId)
      Add a subscription to a channel for given stream and session ids.
      Parameters:
      streamId - to capture within a channel.
      sessionId - to capture within a stream id.
    • removeSubscription

      public void removeSubscription(int streamId)
      Remove a subscription for a previously registered given stream id and wildcard session id.
      Parameters:
      streamId - to remove the capture for.
    • removeSubscription

      public void removeSubscription(int streamId, int sessionId)
      Remove a subscription for a previously registered given stream id and session id.
      Parameters:
      streamId - to remove the capture for.
      sessionId - within the given stream id.
    • addPublicationImage

      public void addPublicationImage(PublicationImage image)
      Add a PublicationImage to dispatch packets to.
      Parameters:
      image - to which the packets are dispatched.
    • removePublicationImage

      public void removePublicationImage(PublicationImage image)
      Remove a previously added PublicationImage so packets are no longer dispatched to it.
      Parameters:
      image - to which the packets are dispatched.
    • removePendingSetup

      public void removePendingSetup(int sessionId, int streamId)
      Remove a pending setup message action once it has been handled.
      Parameters:
      sessionId - of the registered interest.
      streamId - of the registered interest.
    • removeCoolDown

      public void removeCoolDown(int sessionId, int streamId)
      Remove a cool down action once it has expired.
      Parameters:
      sessionId - of the registered interest.
      streamId - of the registered interest.
    • onDataPacket

      public int onDataPacket(ReceiveChannelEndpoint channelEndpoint, DataHeaderFlyweight header, UnsafeBuffer buffer, int length, InetSocketAddress srcAddress, int transportIndex)
      Dispatch a data packet to the registered interest.
      Parameters:
      channelEndpoint - on which the packet was received.
      header - of the data first frame.
      buffer - containing the data packet.
      length - of the data packet.
      srcAddress - from which the data packet was received.
      transportIndex - on which the packet was received.
      Returns:
      number of bytes applied as a result of this action.
    • onSetupMessage

      public void onSetupMessage(ReceiveChannelEndpoint channelEndpoint, SetupFlyweight msg, InetSocketAddress srcAddress, int transportIndex)
      Dispatch a setup message to registered interest.
      Parameters:
      channelEndpoint - of reception.
      msg - flyweight over the network packet.
      srcAddress - the message came from.
      transportIndex - on which the message was received.
    • onRttMeasurement

      public void onRttMeasurement(ReceiveChannelEndpoint channelEndpoint, RttMeasurementFlyweight msg, InetSocketAddress srcAddress, int transportIndex)
      Dispatch an RTT measurement message to registered interest.
      Parameters:
      channelEndpoint - of reception.
      msg - flyweight over the network packet.
      srcAddress - the message came from.
      transportIndex - on which the message was received.
    • shouldElicitSetupMessage

      public boolean shouldElicitSetupMessage()
      Should a setup message be elicited for a channel given interest.
      Returns:
      true if there is interest otherwise false.