use of com.sun.messaging.jmq.jmsserver.data.handlers.ConsumerHandler in project openmq by eclipse-ee4j.
the class CoreLifecycleImpl method initHandlers.
@Override
public void initHandlers(PacketRouter pktrtr, ConnectionManager cmgr, PacketRouter admin_pktrtr, AdminDataHandler admin_datahdrl) throws BrokerException {
this.pktr = pktrtr;
HelloHandler hello = new HelloHandler(cmgr);
hello.setCoreLifecycle(this);
GetLicenseHandler getLicense = new GetLicenseHandler();
getLicense.setCoreLifecycle(this);
GoodbyeHandler goodbye = new GoodbyeHandler();
goodbye.setCoreLifecycle(this);
StartStopHandler startstop = new StartStopHandler();
startstop.setCoreLifecycle(this);
ConsumerHandler conhdlr = new ConsumerHandler();
conhdlr.setCoreLifecycle(this);
ProducerHandler prodhandler = new ProducerHandler();
prodhandler.setCoreLifecycle(this);
DestinationHandler desthandler = new DestinationHandler();
desthandler.setCoreLifecycle(this);
QBrowseHandler qbrowserhdlr = new QBrowseHandler();
qbrowserhdlr.setCoreLifecycle(this);
AuthHandler authenticate = new AuthHandler();
authenticate.setCoreLifecycle(this);
SessionHandler sessionhdlr = new SessionHandler();
sessionhdlr.setCoreLifecycle(this);
PingHandler pinghandler = new PingHandler();
pinghandler.setCoreLifecycle(this);
DataHandler datahdrl = new DataHandler();
datahdrl.setCoreLifecycle(this);
AckHandler ackhandler = new AckHandler();
ackhandler.setCoreLifecycle(this);
RedeliverHandler redeliverhdlr = new RedeliverHandler();
redeliverhdlr.setCoreLifecycle(this);
DeliverHandler deliverhdlr = new DeliverHandler();
deliverhdlr.setCoreLifecycle(this);
TransactionHandler thandler = new TransactionHandler();
thandler.setCoreLifecycle(this);
VerifyDestinationHandler vdhandler = new VerifyDestinationHandler();
vdhandler.setCoreLifecycle(this);
ClientIDHandler clienthandler = new ClientIDHandler();
clienthandler.setCoreLifecycle(this);
FlowHandler flowhdlr = new FlowHandler();
flowhdlr.setCoreLifecycle(this);
FlowPausedHandler fphandler = new FlowPausedHandler();
fphandler.setCoreLifecycle(this);
GenerateUIDHandler genUIDhandler = new GenerateUIDHandler();
genUIDhandler.setCoreLifecycle(this);
InfoRequestHandler infohandler = new InfoRequestHandler();
infohandler.setCoreLifecycle(this);
VerifyTransactionHandler vthandler = new VerifyTransactionHandler();
vthandler.setCoreLifecycle(this);
pktrtr.addHandler(PacketType.HELLO, hello);
pktrtr.addHandler(PacketType.AUTHENTICATE, authenticate);
pktrtr.addHandler(PacketType.GET_LICENSE, getLicense);
pktrtr.addHandler(PacketType.ADD_CONSUMER, conhdlr);
pktrtr.addHandler(PacketType.DELETE_CONSUMER, conhdlr);
pktrtr.addHandler(PacketType.ADD_PRODUCER, prodhandler);
pktrtr.addHandler(PacketType.START, startstop);
pktrtr.addHandler(PacketType.STOP, startstop);
pktrtr.addHandler(PacketType.ACKNOWLEDGE, ackhandler);
pktrtr.addHandler(PacketType.BROWSE, qbrowserhdlr);
pktrtr.addHandler(PacketType.GOODBYE, goodbye);
pktrtr.addHandler(PacketType.REDELIVER, redeliverhdlr);
pktrtr.addHandler(PacketType.CREATE_DESTINATION, desthandler);
pktrtr.addHandler(PacketType.DESTROY_DESTINATION, desthandler);
pktrtr.addHandler(PacketType.VERIFY_DESTINATION, vdhandler);
pktrtr.addHandler(PacketType.DELIVER, deliverhdlr);
pktrtr.addHandler(PacketType.START_TRANSACTION, thandler);
pktrtr.addHandler(PacketType.COMMIT_TRANSACTION, thandler);
pktrtr.addHandler(PacketType.ROLLBACK_TRANSACTION, thandler);
pktrtr.addHandler(PacketType.PREPARE_TRANSACTION, thandler);
pktrtr.addHandler(PacketType.END_TRANSACTION, thandler);
pktrtr.addHandler(PacketType.RECOVER_TRANSACTION, thandler);
pktrtr.addHandler(PacketType.SET_CLIENTID, clienthandler);
pktrtr.addHandler(PacketType.GENERATE_UID, genUIDhandler);
pktrtr.addHandler(PacketType.MAP_MESSAGE, datahdrl);
pktrtr.addHandler(PacketType.BYTES_MESSAGE, datahdrl);
pktrtr.addHandler(PacketType.MESSAGE, datahdrl);
pktrtr.addHandler(PacketType.MESSAGE_SET, datahdrl);
pktrtr.addHandler(PacketType.OBJECT_MESSAGE, datahdrl);
pktrtr.addHandler(PacketType.STREAM_MESSAGE, datahdrl);
pktrtr.addHandler(PacketType.TEXT_MESSAGE, datahdrl);
pktrtr.addHandler(PacketType.RESUME_FLOW, flowhdlr);
pktrtr.addHandler(PacketType.FLOW_PAUSED, fphandler);
pktrtr.addHandler(PacketType.CREATE_SESSION, sessionhdlr);
pktrtr.addHandler(PacketType.DELETE_PRODUCER, prodhandler);
pktrtr.addHandler(PacketType.DESTROY_SESSION, sessionhdlr);
pktrtr.addHandler(PacketType.PING, pinghandler);
pktrtr.addHandler(PacketType.INFO_REQUEST, infohandler);
pktrtr.addHandler(PacketType.VERIFY_TRANSACTION, vthandler);
// Map message handles -> messages. For the admin service this
// is just like the regular JMS service except we have a specialized
// data handler
admin_pktrtr.addHandler(PacketType.HELLO, hello);
admin_pktrtr.addHandler(PacketType.AUTHENTICATE, authenticate);
admin_pktrtr.addHandler(PacketType.GET_LICENSE, getLicense);
admin_pktrtr.addHandler(PacketType.ADD_CONSUMER, conhdlr);
admin_pktrtr.addHandler(PacketType.DELETE_CONSUMER, conhdlr);
admin_pktrtr.addHandler(PacketType.ADD_PRODUCER, prodhandler);
admin_pktrtr.addHandler(PacketType.START, startstop);
admin_pktrtr.addHandler(PacketType.STOP, startstop);
admin_pktrtr.addHandler(PacketType.ACKNOWLEDGE, ackhandler);
admin_pktrtr.addHandler(PacketType.BROWSE, qbrowserhdlr);
admin_pktrtr.addHandler(PacketType.GOODBYE, goodbye);
admin_pktrtr.addHandler(PacketType.REDELIVER, redeliverhdlr);
admin_pktrtr.addHandler(PacketType.CREATE_DESTINATION, desthandler);
admin_pktrtr.addHandler(PacketType.DESTROY_DESTINATION, desthandler);
admin_pktrtr.addHandler(PacketType.VERIFY_DESTINATION, vdhandler);
admin_pktrtr.addHandler(PacketType.DELIVER, deliverhdlr);
admin_pktrtr.addHandler(PacketType.START_TRANSACTION, thandler);
admin_pktrtr.addHandler(PacketType.COMMIT_TRANSACTION, thandler);
admin_pktrtr.addHandler(PacketType.ROLLBACK_TRANSACTION, thandler);
admin_pktrtr.addHandler(PacketType.PREPARE_TRANSACTION, thandler);
admin_pktrtr.addHandler(PacketType.END_TRANSACTION, thandler);
admin_pktrtr.addHandler(PacketType.RECOVER_TRANSACTION, thandler);
admin_pktrtr.addHandler(PacketType.SET_CLIENTID, clienthandler);
admin_pktrtr.addHandler(PacketType.GENERATE_UID, genUIDhandler);
admin_pktrtr.addHandler(PacketType.MAP_MESSAGE, admin_datahdrl);
admin_pktrtr.addHandler(PacketType.BYTES_MESSAGE, admin_datahdrl);
admin_pktrtr.addHandler(PacketType.MESSAGE, admin_datahdrl);
admin_pktrtr.addHandler(PacketType.MESSAGE_SET, admin_datahdrl);
admin_pktrtr.addHandler(PacketType.OBJECT_MESSAGE, admin_datahdrl);
admin_pktrtr.addHandler(PacketType.STREAM_MESSAGE, admin_datahdrl);
admin_pktrtr.addHandler(PacketType.TEXT_MESSAGE, admin_datahdrl);
admin_pktrtr.addHandler(PacketType.RESUME_FLOW, flowhdlr);
admin_pktrtr.addHandler(PacketType.FLOW_PAUSED, fphandler);
admin_pktrtr.addHandler(PacketType.CREATE_SESSION, sessionhdlr);
admin_pktrtr.addHandler(PacketType.DELETE_PRODUCER, prodhandler);
admin_pktrtr.addHandler(PacketType.DESTROY_SESSION, sessionhdlr);
}
use of com.sun.messaging.jmq.jmsserver.data.handlers.ConsumerHandler in project openmq by eclipse-ee4j.
the class ProtocolImpl method unsubscribe.
/**
* Destroys a durable subscription
* <P>
* Packet:<b>DELETE_CONSUMER</b>
* </P>
*
* @param durableName durable name associated with the subscription
* @param clientID clientID associated with the subscription
*/
@Override
public void unsubscribe(String durableName, String clientID, IMQConnection con) throws BrokerException {
ConsumerHandler handler = (ConsumerHandler) pr.getHandler(PacketType.ADD_CONSUMER);
handler.destroyConsumer(con, null, null, durableName, clientID, null, false, false, false);
}
use of com.sun.messaging.jmq.jmsserver.data.handlers.ConsumerHandler in project openmq by eclipse-ee4j.
the class ProtocolImpl method destroyConsumer.
/**
* Closes a consumer
* <P>
* Packet:<b>DELETE_CONSUMER</b>
* </P>
*
* @param uid ConsumerUID to close.
* @param session session associated with the consumer.
* @param lastid last message id seen by application
* @param con Connection associated with the consumer (used for retrieving protocol version).
*/
@Override
public void destroyConsumer(ConsumerUID uid, Session session, SysMessageID lastid, boolean lastidInTransaction, IMQConnection con) throws BrokerException {
ConsumerHandler handler = (ConsumerHandler) pr.getHandler(PacketType.ADD_CONSUMER);
handler.destroyConsumer(con, session, uid, null, null, lastid, lastidInTransaction, (lastid == null), false);
}
use of com.sun.messaging.jmq.jmsserver.data.handlers.ConsumerHandler in project openmq by eclipse-ee4j.
the class ProtocolImpl method createConsumer.
/**
* Create a consumer
* <P>
* Packet:<b>ADD_CONSUMER</b>
* </p>
*
* @param d Destination to create the consumer on
* @param con Connection associated with the consumer
* @param session session associated with the consumer
* @param selector selector string (or null if none)
* @param clientid clientid or null if none
* @param subscriptionName if dest is Topic and if either durable true or share true, the subscription name
* @param durable if dest is Topic, if true, this is a durable subscription
* @param share if dest is Topic, if true, this is a shared subscription
* @param jmsshare if dest is Topic, if true and share true, this is a JMS 2.0 Shared Subscription if false and share
* true, this is a MQ Shared Subscription
* @param nolocal is NoLocal turned on (topics only)
* @param size prefetch size (or -1 if none)
* @param creator_uid a unique id to use as the creator for this consumer which is used for indempotence (usually
* sysmessageid)
* @return a consumer
*/
@Override
public Consumer createConsumer(Destination d, IMQConnection con, Session session, String selector, String clientid, String subscriptionName, boolean durable, boolean share, boolean jmsshare, boolean nolocal, int size, String creator_uid, boolean acc, boolean useFlowControl) throws BrokerException, SelectorFormatException, IOException {
if (DEBUG) {
logger.log(Logger.INFO, "ProtocolImpl.createProducer(d=" + d + ", selector=" + selector + ", clientid=" + clientid + ", subName=" + subscriptionName + ", durable=" + durable + ", share=" + share + ", jmsshare=" + jmsshare + ", nolocal=" + nolocal + ", size=" + size + ", creator_uid=" + creator_uid + ", acc=" + acc + ", useFlowControl=" + useFlowControl + ") on session=" + session + "@" + session.hashCode() + ", conn=@" + con.hashCode() + "[" + con.getConnectionUID() + ", " + con + "]");
}
if (acc) {
checkAccessPermission(PacketType.ADD_CONSUMER, d, con);
}
ConsumerHandler handler = (ConsumerHandler) pr.getHandler(PacketType.ADD_CONSUMER);
String selectorstr = selector;
if (selectorstr != null && selectorstr.trim().length() == 0) {
selectorstr = null;
}
if (d.isTemporary()) {
if (durable) {
String emsg = br.getKString(br.X_INVALID_DEST_DURA_CONSUMER, "" + d.getDestinationUID(), "" + subscriptionName);
logger.log(Logger.ERROR, emsg);
throw new BrokerException(emsg, Status.PRECONDITION_FAILED);
}
if (share) {
String emsg = br.getKString(br.X_INVALID_DEST_SHARE_CONSUMER, "" + d.getDestinationUID(), "" + subscriptionName);
logger.log(Logger.ERROR, emsg);
throw new BrokerException(emsg, Status.PRECONDITION_FAILED);
}
}
Consumer[] c = handler.createConsumer(d.getDestinationUID(), con, session, selectorstr, clientid, subscriptionName, durable, share, jmsshare, nolocal, size, creator_uid, false, useFlowControl);
if (c[2] != null) {
c[2].resume("Resuming from protocol");
}
if (c[1] != null) {
c[1].resume("Resuming from protocol");
}
return c[0];
}
Aggregations