use of jakarta.resource.NotSupportedException in project openmq by eclipse-ee4j.
the class EndpointConsumer method createDirectMessageConsumer.
/**
* Create a direct mode message consumer
*/
protected void createDirectMessageConsumer() throws NotSupportedException {
try {
// Use method that avoids allocation via the ConnectionManager
this.dc = (DirectConnection) dcf._createConnection(username, password);
if (this.clientId != null) {
this.dc._setClientID(this.clientId);
}
if (ResourceAdapter._isFixCR6760301()) {
this.ds = (DirectSession) this.dc.createSessionForRAEndpoint();
} else {
this.ds = (DirectSession) this.dc.createSession(false, Session.CLIENT_ACKNOWLEDGE);
}
// Set the Session to be an MDB Session
this.ds._setMDBSession(true);
if (aSpec.getSubscriptionScope() != null) {
subscriptionName = getSubscriptionName();
if (this.isDurable) {
this.msgConsumer = this.ds.createSharedDurableConsumer((Topic) this.destination, subscriptionName, this.selector);
} else {
this.msgConsumer = this.ds.createSharedConsumer((Topic) this.destination, subscriptionName, this.selector);
}
} else {
if (this.isDurable) {
this.msgConsumer = this.ds.createDurableSubscriber((Topic) this.destination, this.subscriptionName, this.selector, false);
} else {
this.msgConsumer = this.ds.createConsumer(this.destination, this.selector);
}
}
this.msgListener = new MessageListener(this, this.endpointFactory, this.aSpec, this.noAckDelivery, this.useRADirect);
this.msgConsumer.setMessageListener(this.msgListener);
this.dc.start();
updateFactoryConsumerTables(this.endpointFactory);
} catch (JMSException jmse) {
if (this.dc != null) {
try {
this.dc.close();
} catch (JMSException jmsecc) {
// System.out.println("MQRA:EC:closed xac on conn creation exception-"+jmsecc.getMessage());
}
this.dc = null;
}
NotSupportedException nse = new NotSupportedException("MQRA:EC:Error creating Direct Message Consumer:\n" + jmse.getMessage());
nse.initCause(jmse);
throw nse;
}
}
Aggregations