// Create the message handler
SessionState sessionState =
(SessionState)((DelegateSupport)invocation.getTargetObject()).getState();
ConnectionState connectionState = (ConnectionState)sessionState.getParent();
SessionDelegate sessionDelegate = (SessionDelegate)invocation.getTargetObject();
ConsumerState consumerState = (ConsumerState)((DelegateSupport)consumerDelegate).getState();
String consumerID = consumerState.getConsumerID();
int prefetchSize = consumerState.getBufferSize();
Executor executor = sessionState.getExecutor();
int maxDeliveries = consumerState.getMaxDeliveries();