use of javax.jms.JMSException in project ACS by ACS-Community.
the class DefaultPublisherImpl method createTextMessage.
/**
* Method createTextMessage
*
*
* @return TextMessage
*
* @throws JMSException
*
*/
public TextMessage createTextMessage() throws JMSException {
if (closed) {
throw (new JMSException("Publisher object has been closed"));
}
TextMessage message = null;
message = session.createTextMessage();
return message;
}
use of javax.jms.JMSException in project ACS by ACS-Community.
the class DefaultPublisherImpl method initialize.
/**
* Method initialize.
*
* @param retry
* @throws MOMException
*/
private void initialize(boolean retry) throws MOMException {
momProperties = MomConfig.getProperties(this.getClass().getClassLoader());
defaultPersistance = (momProperties.getProperty(MomConfig.MSG_PERSISTANCE_PROPERTY).equals("true") ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
defaultPriority = Integer.parseInt(momProperties.getProperty(MomConfig.MSG_PRIORITY_PROPERTY));
defaultTimeToLive = Long.parseLong(momProperties.getProperty(MomConfig.MSG_TIMETOLIVE_PROPERTY));
topicDirectory = new HashMap();
try {
connection = JMSTopicConnectionFactory.createJMSTopicConnection(username, password, brokerList, loadBalancing, sequential, selectorAtBroker);
connection.connect(retry);
connection.setExceptionListener(this);
session = connection.createTopicSession();
connection.start();
publisher = session.createPublisher(null);
closed = false;
} catch (ConnectionException e) {
System.out.println("Exception caught: " + e.getMessage());
e.printStackTrace(System.err);
throw new MOMException("Unable to estabilish a connection, cause is : " + e.getMessage());
} catch (JMSException e) {
System.out.println("Exception caught: " + e.getMessage());
e.printStackTrace(System.err);
throw (new MOMException(e.getMessage()));
}
}
use of javax.jms.JMSException in project ACS by ACS-Community.
the class DefaultPublisherImpl method createBytesMessage.
/**
* Method createBytesMessage
*
*
* @return BytesMessage
*
* @throws JMSException
*
*/
public BytesMessage createBytesMessage() throws JMSException {
if (closed) {
throw (new JMSException("Publisher object has been closed"));
}
BytesMessage message = null;
message = session.createBytesMessage();
return message;
}
use of javax.jms.JMSException in project ACS by ACS-Community.
the class DefaultPublisherImpl method createStreamMessage.
/**
* Method createStreamMessage
*
*
* @return StreamMessage
*
* @throws JMSException
*
*/
public StreamMessage createStreamMessage() throws JMSException {
if (closed) {
throw (new JMSException("Publisher object has been closed"));
}
StreamMessage message = null;
message = session.createStreamMessage();
return message;
}
use of javax.jms.JMSException in project ACS by ACS-Community.
the class DefaultSubscriberImpl method unSubscribe.
/**
* Method unSubscribe
*
*
* @param token
*
* @throws JMSException
*
*/
public void unSubscribe(long token) throws JMSException {
cat.info("unSubscribe(" + token + ")");
if (closed) {
throw (new JMSException("Subscriber closed."));
}
synchronized (subscribers) {
Long key = new Long(token);
SubscriptionHandle handle = (SubscriptionHandle) subscribers.get(key);
if (handle != null) {
handle.getSubscriber().close();
handle.getSession().close();
if (!NotificationHelper.isNotification(handle.getSubscriptionTopic())) {
publishNotification(NotificationHelper.CONSUMER_CLOSE_NOTIFICATION, handle);
}
subscribers.remove(key);
}
}
}
Aggregations