boolean isCC = ((Boolean)mi.getArguments()[4]).booleanValue();
// 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();
int consumerID = consumerState.getConsumerID();
int prefetchSize = consumerState.getBufferSize();
QueuedExecutor sessionExecutor = sessionState.getExecutor();
int maxDeliveries = consumerState.getMaxDeliveries();
//We need the queue name for recovering any deliveries after failover
String queueName = null;
if (consumerState.getSubscriptionName() != null)
{
queueName = MessageQueueNameHelper.
createSubscriptionName(connectionState.getClientID(),
consumerState.getSubscriptionName());
}
else if (consumerState.getDestination().isQueue())
{
queueName = consumerState.getDestination().getName();
}
MessageCallbackHandler messageHandler =
new MessageCallbackHandler(isCC, sessionState.getAcknowledgeMode(),
sessionDelegate, consumerDelegate, consumerID, queueName,
prefetchSize, sessionExecutor, maxDeliveries);
sessionState.addCallbackHandler(messageHandler);
CallbackManager cm = connectionState.getRemotingConnection().getCallbackManager();
cm.registerHandler(consumerID, messageHandler);
consumerState.setMessageCallbackHandler(messageHandler);
//Now we have finished creating the client consumer, we can tell the SCD