List of usage examples for javax.jms JMSException getMessage
public String getMessage()
From source file:org.frameworkset.mq.RequestDispatcher.java
public void send(int destinationType, String destination_, boolean persistent, int priority, long timeToLive, Message message, Logger step, JMSProperties properties) throws JMSException { if (step != null) step.logBasic("send message to " + destination_ + " assertStarted(),message=" + message); assertStarted();//ww w . ja v a2s . co m MessageProducer producer = null; try { Destination destination = null; // boolean isqueue = destinationType == MQUtil.TYPE_QUEUE; // if (isqueue) // { // if(step != null) // step.logBasic("send message to " + destination_ // + " build QUEUE destination"); // destination = session.createQueue(destination_); // if(step != null) // step.logBasic("send message to " + destination_ // + " build QUEUE destination end"); // } // else // { // if(step != null) // step.logBasic("send message to " + destination_ // + " build Topic destination"); // destination = session.createTopic(destination_); // if(step != null) // step.logBasic("send message to " + destination_ // + " build Topic destination end"); // } if (step != null) step.logBasic("send message to " + destination_ + " build destination."); destination = this.connection.createDestination(session, destination_, destinationType); if (step != null) step.logBasic("send message to " + destination_ + " build destination end"); int deliveryMode = persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT; if (step != null) step.logBasic("send message to " + destination_ + " this.client.isPersistent =" + persistent); if (step != null) step.logBasic("send message to " + destination + " send started...."); producer = session.createProducer(destination); if (properties != null) MQUtil.initMessage(message, properties); producer.send(message, deliveryMode, priority, timeToLive); if (step != null) step.logBasic("send message to " + destination + " send end...."); if (LOG.isDebugEnabled()) { LOG.debug("Sent! to destination: " + destination + " message: " + message); } } catch (JMSException e) { throw e; } catch (Exception e) { throw new JMSException(e.getMessage()); } finally { if (producer != null) try { producer.close(); } catch (Exception e) { } } }
From source file:org.apache.qpid.disttest.jms.ClientJmsDelegate.java
private void appendErrorMessage(StringBuilder errorMessages, JMSException e) { if (errorMessages.length() > 0) { errorMessages.append('\n'); }/*from w w w. j ava 2 s.c o m*/ errorMessages.append(e.getMessage()); }
From source file:org.wso2.carbon.inbound.endpoint.protocol.jms.factory.JMSConnectionFactory.java
public MessageConsumer createMessageConsumer(Session session, Destination destination) { try {/*from w w w. j a v a 2 s . com*/ if (JMSConstants.JMS_SPEC_VERSION_2_0.equals(jmsSpec) && isSharedSubscription) { if (isDurable) { return session.createSharedDurableConsumer((Topic) destination, subscriptionName, messageSelector); } else { return session.createSharedConsumer((Topic) destination, subscriptionName, messageSelector); } } else if ((JMSConstants.JMS_SPEC_VERSION_1_1.equals(jmsSpec)) || (JMSConstants.JMS_SPEC_VERSION_2_0.equals(jmsSpec) && !isSharedSubscription)) { if (isDurable) { return session.createDurableSubscriber((Topic) destination, subscriptionName, messageSelector, noPubSubLocal); } else { return session.createConsumer(destination, messageSelector); } } else { if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { return ((QueueSession) session).createReceiver((Queue) destination, messageSelector); } else { if (isDurable) { return ((TopicSession) session).createDurableSubscriber((Topic) destination, subscriptionName, messageSelector, noPubSubLocal); } else { return ((TopicSession) session).createSubscriber((Topic) destination, messageSelector, false); } } } } catch (JMSException e) { logger.error("JMS Exception while creating consumer. " + e.getMessage(), e); } return null; }
From source file:org.grouter.common.jms.TopicSenderDestination.java
@Override public synchronized void sendMessage(Message message, int deliveryMode, int messagePriority, long timeToLive) { try {//from w w w . j a va 2 s .c om setJMSHeader(message); topicPublisher.send(message, deliveryMode, messagePriority, timeToLive); logger.debug("Message sent to destination : " + destinationName); } catch (JMSException ex) { logger.error("Failed sending message to JMS provider using destination " + destinationName + ". Error message : " + ex.getMessage(), ex); } catch (IllegalStateException ex) { logger.error("Failed sending message to JMS provider using destination " + destinationName + ". Error message : " + ex.getMessage(), ex); } }
From source file:org.grouter.common.jms.TopicSenderDestination.java
@Override public synchronized void sendMessage(Message message) { try {//from ww w . ja va2 s . com setJMSHeader(message); topicPublisher.send(message); logger.debug("Message sent to destination : " + destinationName); } catch (JMSException ex) { logger.error("Failed sending message to JMS provider using destination " + destinationName + ". Error message : " + ex.getMessage(), ex); } catch (IllegalStateException ex) { logger.error("Failed sending message to JMS provider using destination " + destinationName + ". Error message : " + ex.getMessage(), ex); } }
From source file:org.grouter.common.jms.TopicSenderDestination.java
@Override public void sendMessage(Serializable message) { try {//from w w w . j a va2 s .c o m ObjectMessage msg = createMessage(message, null); topicPublisher.send(msg); logger.debug("Message sent to destination : " + destinationName); } catch (JMSException ex) { logger.error("Failed sending message to JMS provider using destination " + destinationName + ". Error message : " + ex.getMessage(), ex); } catch (IllegalStateException ex) { logger.error("Failed sending message to JMS provider using destination " + destinationName + ". Error message : " + ex.getMessage(), ex); } }
From source file:org.grouter.common.jms.TopicSenderDestination.java
@Override public void sendMessage(String message) { try {/*from www. j a v a 2s . c o m*/ ObjectMessage msg = this.topicSession.createObjectMessage(message); setJMSHeader(msg); topicPublisher.send(msg); logger.debug("Message sent to destination : " + destinationName); } catch (JMSException ex) { logger.error("Failed sending message to JMS provider using destination " + destinationName + ". Error message : " + ex.getMessage()); } catch (IllegalStateException ex) { logger.error("Failed sending message to JMS provider using destination " + destinationName + ". Error message : " + ex.getMessage()); } }
From source file:org.grouter.common.jms.TopicSenderDestination.java
@Override public synchronized void sendMessage(Serializable message, HashMap<String, String> headerProperties) { try {/*from w ww . ja v a 2s .co m*/ ObjectMessage msg = createMessage(message, headerProperties); setJMSHeader(msg); topicPublisher.send(msg, this.acknowledgeMode, this.messagePriority, this.timeToLive); logger.debug("Message sent to destination : " + destinationName); } catch (JMSException ex) { logger.error("Failed sending message to JMS provider using destination " + destinationName + ". Error message : " + ex.getMessage()); } catch (IllegalStateException ex) { logger.error("Failed sending message to JMS provider using destination " + destinationName + ". Error message : " + ex.getMessage(), ex); } }
From source file:org.grouter.common.jms.TopicSenderDestination.java
/** * <b>See documentation in {@link org.grouter.common.jms.AbstractSenderDestination#sendMessage(java.io.Serializable,int,int,long,java.util.HashMap)}.</b><br> * <br>// w w w . j a v a 2 s.co m */ public void sendMessage(Serializable message, int deliveryMode, int messagePriority, long timeToLive, HashMap<String, String> headerProperties) { try { ObjectMessage msg = createMessage(message, headerProperties); setJMSHeader(msg); topicPublisher.send(msg, deliveryMode, messagePriority, timeToLive); logger.debug("Message sent to destination : " + destinationName); } catch (JMSException ex) { logger.error("Failed sending message to JMS provider using destination " + destinationName + ". Error message : " + ex.getMessage(), ex); } catch (IllegalStateException ex) { logger.error("Failed sending message to JMS provider using destination " + destinationName + ". Error message : " + ex.getMessage(), ex); } }
From source file:com.googlecode.fascinator.indexer.SolrWrapperQueueConsumer.java
/** * Stop the Render Queue Consumer. Including stopping the storage and * indexer/*from w w w . ja v a2 s . c o m*/ */ @Override public void stop() throws Exception { log.info("Stopping {}...", name); submitBuffer(true); if (coreContainer != null) { coreContainer.shutdown(); } if (consumer != null) { try { consumer.close(); } catch (JMSException jmse) { log.warn("Failed to close consumer: {}", jmse.getMessage()); throw jmse; } } if (session != null) { try { session.close(); } catch (JMSException jmse) { log.warn("Failed to close consumer session: {}", jmse); } } if (connection != null) { try { connection.close(); } catch (JMSException jmse) { log.warn("Failed to close connection: {}", jmse); } } timer.cancel(); }