request.getFilterString(),
request.isTemporary(),
request.isDurable());
if (requiresResponse)
{
response = new NullResponseMessage();
}
break;
}
case CREATE_SHARED_QUEUE:
{
CreateSharedQueueMessage request = (CreateSharedQueueMessage)packet;
requiresResponse = request.isRequiresResponse();
session.createSharedQueue(request.getAddress(),
request.getQueueName(),
request.isDurable(),
request.getFilterString());
if (requiresResponse)
{
response = new NullResponseMessage();
}
break;
}
case DELETE_QUEUE:
{
requiresResponse = true;
SessionDeleteQueueMessage request = (SessionDeleteQueueMessage)packet;
session.deleteQueue(request.getQueueName());
response = new NullResponseMessage();
break;
}
case SESS_QUEUEQUERY:
{
requiresResponse = true;
SessionQueueQueryMessage request = (SessionQueueQueryMessage)packet;
QueueQueryResult result = session.executeQueueQuery(request.getQueueName());
response = new SessionQueueQueryResponseMessage(result);
break;
}
case SESS_BINDINGQUERY:
{
requiresResponse = true;
SessionBindingQueryMessage request = (SessionBindingQueryMessage)packet;
BindingQueryResult result = session.executeBindingQuery(request.getAddress());
response = new SessionBindingQueryResponseMessage(result.isExists(), result.getQueueNames());
break;
}
case SESS_ACKNOWLEDGE:
{
SessionAcknowledgeMessage message = (SessionAcknowledgeMessage)packet;
requiresResponse = message.isRequiresResponse();
session.acknowledge(message.getConsumerID(), message.getMessageID());
if (requiresResponse)
{
response = new NullResponseMessage();
}
break;
}
case SESS_EXPIRED:
{
SessionExpireMessage message = (SessionExpireMessage)packet;
session.expire(message.getConsumerID(), message.getMessageID());
break;
}
case SESS_COMMIT:
{
requiresResponse = true;
session.commit();
response = new NullResponseMessage();
break;
}
case SESS_ROLLBACK:
{
requiresResponse = true;
session.rollback(((RollbackMessage) packet).isConsiderLastMessageAsDelivered());
response = new NullResponseMessage();
break;
}
case SESS_XA_COMMIT:
{
requiresResponse = true;
SessionXACommitMessage message = (SessionXACommitMessage)packet;
session.xaCommit(message.getXid(), message.isOnePhase());
response = new SessionXAResponseMessage(false, XAResource.XA_OK, null);
break;
}
case SESS_XA_END:
{
requiresResponse = true;
SessionXAEndMessage message = (SessionXAEndMessage)packet;
session.xaEnd(message.getXid());
response = new SessionXAResponseMessage(false, XAResource.XA_OK, null);
break;
}
case SESS_XA_FORGET:
{
requiresResponse = true;
SessionXAForgetMessage message = (SessionXAForgetMessage)packet;
session.xaForget(message.getXid());
response = new SessionXAResponseMessage(false, XAResource.XA_OK, null);
break;
}
case SESS_XA_JOIN:
{
requiresResponse = true;
SessionXAJoinMessage message = (SessionXAJoinMessage)packet;
session.xaJoin(message.getXid());
response = new SessionXAResponseMessage(false, XAResource.XA_OK, null);
break;
}
case SESS_XA_RESUME:
{
requiresResponse = true;
SessionXAResumeMessage message = (SessionXAResumeMessage)packet;
session.xaResume(message.getXid());
response = new SessionXAResponseMessage(false, XAResource.XA_OK, null);
break;
}
case SESS_XA_ROLLBACK:
{
requiresResponse = true;
SessionXARollbackMessage message = (SessionXARollbackMessage)packet;
session.xaRollback(message.getXid());
response = new SessionXAResponseMessage(false, XAResource.XA_OK, null);
break;
}
case SESS_XA_START:
{
requiresResponse = true;
SessionXAStartMessage message = (SessionXAStartMessage)packet;
session.xaStart(message.getXid());
response = new SessionXAResponseMessage(false, XAResource.XA_OK, null);
break;
}
case SESS_XA_FAILED:
{
requiresResponse = true;
SessionXAAfterFailedMessage message = (SessionXAAfterFailedMessage)packet;
session.xaFailed(message.getXid());
response = new SessionXAResponseMessage(false, XAResource.XA_OK, null);
break;
}
case SESS_XA_SUSPEND:
{
requiresResponse = true;
session.xaSuspend();
response = new SessionXAResponseMessage(false, XAResource.XA_OK, null);
break;
}
case SESS_XA_PREPARE:
{
requiresResponse = true;
SessionXAPrepareMessage message = (SessionXAPrepareMessage)packet;
session.xaPrepare(message.getXid());
response = new SessionXAResponseMessage(false, XAResource.XA_OK, null);
break;
}
case SESS_XA_INDOUBT_XIDS:
{
requiresResponse = true;
List<Xid> xids = session.xaGetInDoubtXids();
response = new SessionXAGetInDoubtXidsResponseMessage(xids);
break;
}
case SESS_XA_GET_TIMEOUT:
{
requiresResponse = true;
int timeout = session.xaGetTimeout();
response = new SessionXAGetTimeoutResponseMessage(timeout);
break;
}
case SESS_XA_SET_TIMEOUT:
{
requiresResponse = true;
SessionXASetTimeoutMessage message = (SessionXASetTimeoutMessage)packet;
session.xaSetTimeout(message.getTimeoutSeconds());
response = new SessionXASetTimeoutResponseMessage(true);
break;
}
case SESS_START:
{
session.start();
break;
}
case SESS_STOP:
{
requiresResponse = true;
session.stop();
response = new NullResponseMessage();
break;
}
case SESS_CLOSE:
{
requiresResponse = true;
session.close(false);
// removeConnectionListeners();
response = new NullResponseMessage();
flush = true;
closeChannel = true;
break;
}
case SESS_INDIVIDUAL_ACKNOWLEDGE:
{
SessionIndividualAcknowledgeMessage message = (SessionIndividualAcknowledgeMessage)packet;
requiresResponse = message.isRequiresResponse();
session.individualAcknowledge(message.getConsumerID(), message.getMessageID());
if (requiresResponse)
{
response = new NullResponseMessage();
}
break;
}
case SESS_CONSUMER_CLOSE:
{
requiresResponse = true;
SessionConsumerCloseMessage message = (SessionConsumerCloseMessage)packet;
session.closeConsumer(message.getConsumerID());
response = new NullResponseMessage();
break;
}
case SESS_FLOWTOKEN:
{
SessionConsumerFlowCreditMessage message = (SessionConsumerFlowCreditMessage)packet;
session.receiveConsumerCredits(message.getConsumerID(), message.getCredits());
break;
}
case SESS_SEND:
{
SessionSendMessage message = (SessionSendMessage)packet;
requiresResponse = message.isRequiresResponse();
session.send((ServerMessage)message.getMessage(), direct);
if (requiresResponse)
{
response = new NullResponseMessage();
}
break;
}
case SESS_SEND_LARGE:
{
SessionSendLargeMessage message = (SessionSendLargeMessage)packet;
session.sendLarge(message.getLargeMessage());
break;
}
case SESS_SEND_CONTINUATION:
{
SessionSendContinuationMessage message = (SessionSendContinuationMessage)packet;
requiresResponse = message.isRequiresResponse();
session.sendContinuations(message.getPacketSize(), message.getMessageBodySize(), message.getBody(), message.isContinues());
if (requiresResponse)
{
response = new NullResponseMessage();
}
break;
}
case SESS_FORCE_CONSUMER_DELIVERY:
{
SessionForceConsumerDelivery message = (SessionForceConsumerDelivery)packet;
session.forceConsumerDelivery(message.getConsumerID(), message.getSequence());
break;
}
case PacketImpl.SESS_PRODUCER_REQUEST_CREDITS:
{
SessionRequestProducerCreditsMessage message = (SessionRequestProducerCreditsMessage)packet;
session.requestProducerCredits(message.getAddress(), message.getCredits());
break;
}
case PacketImpl.SESS_ADD_METADATA:
{
response = new NullResponseMessage();
SessionAddMetaDataMessage message = (SessionAddMetaDataMessage)packet;
session.addMetaData(message.getKey(), message.getData());
break;
}
case PacketImpl.SESS_ADD_METADATA2:
{
SessionAddMetaDataMessageV2 message = (SessionAddMetaDataMessageV2)packet;
if (message.isRequiresConfirmations())
{
response = new NullResponseMessage();
}
session.addMetaData(message.getKey(), message.getData());
break;
}
case PacketImpl.SESS_UNIQUE_ADD_METADATA:
{
SessionUniqueAddMetaDataMessage message = (SessionUniqueAddMetaDataMessage)packet;
if (session.addUniqueMetaData(message.getKey(), message.getData()))
{
response = new NullResponseMessage();
}
else
{
response = new HornetQExceptionMessage(HornetQMessageBundle.BUNDLE.duplicateMetadata(message.getKey(), message.getData()));
}