List of usage examples for javax.jms JMSException printStackTrace
public void printStackTrace()
From source file:QueueRoundTrip.java
/** Cleanup resources and then exit. */ private void exit() { try {/*from w w w . j av a 2 s .c om*/ connection.close(); } catch (javax.jms.JMSException jmse) { jmse.printStackTrace(); } System.exit(0); }
From source file:com.provenance.cloudprovenance.connector.policy.PolicyEventConsumer.java
/** Method called when a new message arrives */ public void onMessage(final Message message) { final String outcome; logger.info("Received policy request message = " + counter++); // Check if the message is a text message if (message instanceof TextMessage) { TextMessage textMessage = (TextMessage) message; String policyRequest = null; try {/*from w w w .j a v a2 s . c o m*/ policyRequest = textMessage.getText(); logger.info("Sending poicy request: " + policyRequest + " ....."); String response = poEnforcement.policyRequest(serviceID, policyRequest); logger.info("Response received for policy request: " + response); String responsURI = resExtraction.getResponseURI(response); logger.debug("Sucessfully extracted response message URI from the policy execution: " + responsURI); outcome = poEnforcement.policyResponse(serviceID, new URL(responsURI)); logger.info("Successfully retrieved a policy response: " + outcome); logger.info( "Sending the retrieved response to a Queue for a client to read: " + outcome + " ......"); jmsTemplate.send(responsePolicyQueueName, new MessageCreator() { public Message createMessage(Session session) throws JMSException { TextMessage message = session.createTextMessage(outcome); return message; } }); logger.info("Successfully sent the response via the JMS queue to a client"); } catch (JMSException e) { e.printStackTrace(); } catch (XPathExpressionException e) { e.printStackTrace(); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } else { logger.warn("Message received, but unable to process : " + message + " ... !"); } }
From source file:eu.learnpad.simulator.mon.probe.GlimpseAbstractProbe.java
/** * This method send a {@link GlimpseBaseEvent} message on the ESB<br /> * specifically on the channel specified in the {@link #settings} object. * /*from ww w. j a v a2 s .c o m*/ * @param event the event to send * @param debug * @throws JMSException * @throws NamingException */ protected void sendEventMessage(GlimpseBaseEventAbstract<?> event, boolean debug) throws JMSException, NamingException { if (debug) { DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(), "Creating Message "); } try { ObjectMessage messageToSend = publishSession.createObjectMessage(); messageToSend.setJMSMessageID(String.valueOf(MESSAGEID++)); messageToSend.setObject(event); if (debug) { DebugMessages.ok(); DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(), "Publishing message "); } tPub.publish(messageToSend); if (debug) { DebugMessages.ok(); DebugMessages.line(); } } catch (JMSException e) { e.printStackTrace(); } }
From source file:Requestor.java
/** Cleanup resources cleanly and exit. */ private void exit() { try {//from www. j av a 2 s .c o m requestor.close(); connect.close(); } catch (javax.jms.JMSException jmse) { jmse.printStackTrace(); } System.exit(0); }
From source file:org.sakaiproject.kernel.messaging.email.EmailMessagingService.java
@Inject public EmailMessagingService(@Named(KernelConstants.JMS_BROKER_URL) String brokerUrl, @Named(KernelConstants.JMS_EMAIL_QUEUE) String emailQueueName, @Named(KernelConstants.JMS_EMAIL_TYPE) String emailJmsType, JCRNodeFactoryService jcrNodeFactory, MessageConverter msgConverter, Injector injector, UserFactoryService userFactory) { super(jcrNodeFactory, msgConverter, injector, userFactory); connectionFactory = new ActiveMQConnectionFactory(brokerUrl); try {/*from w ww . j av a 2 s . co m*/ // prob want to use username,pw here Connection conn = connectionFactory.createTopicConnection(); conn.setClientID("kernel.email1"); connections.add(conn); } catch (JMSException e) { connectionFactory = null; try { throw e; } catch (JMSException e1) { e1.printStackTrace(); } } startConnections(); createSessions(); }
From source file:it.cnr.isti.labse.glimpse.impl.ComplexEventProcessorImpl.java
public void run() { DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(), "Starting connection "); try {//from ww w.j a va 2 s .c o m connection.start(); tSub.setMessageListener(this); DebugMessages.ok(); DebugMessages.line(); while (this.getState() == State.RUNNABLE) { Thread.sleep(20); ksession.fireAllRules(); } } catch (JMSException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:org.wso2.mb.integration.common.clients.operations.topic.TopicMessageListener.java
public void unsubscribeConsumer() { new Thread(new Runnable() { public void run() { try { log.info("unSubscribing Subscriber"); topicSession.unsubscribe(subscriptionId); topicReceiver.close();/*from w w w . j av a 2s . co m*/ topicSession.close(); topicConnection.close(); } catch (JMSException e) { e.printStackTrace(); } } }).start(); }
From source file:it.cnr.isti.labse.glimpse.impl.ComplexEventProcessorImpl.java
@Override public void onMessage(Message arg0) { ObjectMessage msg = (ObjectMessage) arg0; try {/*from ww w . ja v a2s . c o m*/ GlimpseBaseEvent<?> receivedEvent = (GlimpseBaseEvent<?>) msg.getObject(); if (eventStream != null) { try { eventStream.insert(receivedEvent); DebugMessages.println(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(), "receives: " + receivedEvent.getData() + " from: " + receivedEvent.getConnectorID() + " execution: " + receivedEvent.getConnectorInstanceID()); DebugMessages.line(); } catch (org.drools.RuntimeDroolsException droolsCrashException) { DebugMessages.println(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(), droolsCrashException.getMessage()); new UnknownMethodCallRuleException(); } } } catch (JMSException e) { e.printStackTrace(); } catch (ClassCastException ex) { } }
From source file:de.adorsys.jmspojo.JMSJavaFutureAdapterTest.java
@Before public void setup() throws Exception { broker = new BrokerService(); broker.setPersistent(false);//from www. j ava2s .c o m // configure the broker broker.addConnector("vm://test"); broker.setBrokerName("test"); broker.setUseShutdownHook(false); broker.start(); cf = new ActiveMQConnectionFactory("vm://localhost?create=false"); qc = cf.createQueueConnection(); QueueSession createQueueSession = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); testQueue = createQueueSession.createQueue("TestQueue"); createQueueSession.createReceiver(testQueue).setMessageListener(new MessageListener() { @Override public void onMessage(Message message) { try { boolean sendTimeout = message.getBooleanProperty("timeout"); boolean sendError = message.getBooleanProperty("error"); if (sendError) { JMSJavaFutureAdapter<PingMessage> jmsSender = new JMSJavaFutureAdapter<PingMessage>( objectMapper, cf, null, TIMEOUT); HashMap<String, Object> messageProperties = new HashMap<String, Object>(); messageProperties.put("ERROR", "test error"); jmsSender.send(message.getJMSReplyTo(), messageProperties, null); } else if (!sendTimeout) { JMSJavaFutureAdapter<PingMessage> jmsSender = new JMSJavaFutureAdapter<PingMessage>( objectMapper, cf, null, TIMEOUT); jmsSender.send(message.getJMSReplyTo(), null, ((TextMessage) message).getText()); } } catch (JMSException e) { e.printStackTrace(); } } }); qc.start(); }
From source file:eu.learnpad.simulator.mon.manager.ResponseDispatcher.java
public ResponseDispatcher(InitialContext initConn, TopicConnectionFactory connectionFact, HashMap<Object, ConsumerProfile> requestMap) { ResponseDispatcher.requestMap = requestMap; ResponseDispatcher.initConn = initConn; try {/*from w w w . ja v a 2s. co m*/ connection = connectionFact.createTopicConnection(); publishSession = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); } catch (JMSException e) { e.printStackTrace(); } }