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();
String consumerID = consumerState.getConsumerID();
int prefetchSize = consumerState.getBufferSize();
Executor executor = sessionState.getExecutor();
int maxDeliveries = consumerState.getMaxDeliveries();
long redeliveryDelay = consumerState.getRedeliveryDelay();
//We need the queue name for recovering any deliveries after failover
String queueName = null;
if (consumerState.getSubscriptionName() != null)
{
// I have to use the clientID from connectionDelegate instead of connectionState...
// this is because when a pre configured CF is used we need to get the clientID from
// server side.
// This was a condition verified by the TCK and it was fixed as part of
// http://jira.jboss.com/jira/browse/JBMESSAGING-939
queueName = MessageQueueNameHelper.
createSubscriptionName(((ConnectionDelegate)connectionState.getDelegate()).getClientID(),
consumerState.getSubscriptionName());
}
else if (consumerState.getDestination().isQueue())
{
queueName = consumerState.getDestination().getName();
}
boolean autoFlowControl = ((Boolean)mi.getArguments()[5]).booleanValue();
ClientConsumer messageHandler =
new ClientConsumer(isCC, sessionState.getAcknowledgeMode(),
sessionDelegate, consumerDelegate, consumerID, queueName,
prefetchSize, executor, maxDeliveries, consumerState.isShouldAck(),
redeliveryDelay);
sessionState.addCallbackHandler(messageHandler);
CallbackManager cm = connectionState.getRemotingConnection().getCallbackManager();
cm.registerHandler(consumerID, messageHandler);
consumerState.setClientConsumer(messageHandler);
if (autoFlowControl)