Interface NettyCamelStateCorrelationManager

All Known Implementing Classes:
DefaultNettyCamelStateCorrelationManager, TimeoutCorrelationManagerSupport

public interface NettyCamelStateCorrelationManager
To manage and correlate state of NettyCamelState when doing request/reply via NettyProducer.

This SPI allows custom implementations to correlate the request and replies.

  • Method Summary

    Modifier and Type
    Method
    Description
    getState(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.Channel channel, Object msg)
    Gets the state when a response message has been received.
    getState(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.Channel channel, Throwable cause)
    Gets the state when some internal error occurred.
    void
    putState(io.netty.channel.Channel channel, NettyCamelState state)
    Puts the state.
    void
    removeState(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.Channel channel)
    Removes the state when the channel is inactive.
  • Method Details

    • putState

      void putState(io.netty.channel.Channel channel, NettyCamelState state)
      Puts the state.

      You can get access to the Camel message from the NettyCamelState instance.

      Parameters:
      channel - the channel
      state - the Camel state to be stored
    • removeState

      void removeState(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.Channel channel)
      Removes the state when the channel is inactive.
      Parameters:
      ctx - netty channel handler context
      channel - the channel
    • getState

      NettyCamelState getState(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.Channel channel, Object msg)
      Gets the state when a response message has been received.

      If the implementation stores the state temporary in for example a Map instance then this method should remove the state from the map as its no longer needed. In other words use the Map.remove(Object) to get and remove the state.

      Parameters:
      ctx - netty channel handler context
      channel - the channel
      msg - the response message
    • getState

      NettyCamelState getState(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.Channel channel, Throwable cause)
      Gets the state when some internal error occurred.
      Parameters:
      ctx - netty channel handler context
      channel - the channel
      cause - the error