List of usage examples for javax.jms JMSException printStackTrace
public void printStackTrace()
From source file:samples.SpringJmsConsumer.java
@Override public void onMessage(Message message) { try {// ww w . j a va2 s . c o m if (message instanceof TextMessage) { TextMessage textMessage = (TextMessage) message; System.out.println("Received Text Message: " + textMessage.getText()); } else { System.out.println("Received Non-Text Message: " + message); } } catch (JMSException ex) { ex.printStackTrace(); } }
From source file:org.panksdmz.jms.tibco.MessageRecieverBean.java
public void recieve() { try {/*from w ww .jav a2 s .co m*/ QueueConnection connection = connectionFactory.createQueueConnection(); QueueSession session = connection.createQueueSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue(this.recieveQueueName); QueueReceiver receiver = session.createReceiver(queue); connection.start(); Message receive = receiver.receive(); System.out.println(receive); } catch (JMSException e) { e.printStackTrace(); } }
From source file:com.oracle.demo.ops.jms.listener.event.queue.EventForwarderMessageListenerMDP.java
@Override public void onMessage(Message message) { System.out.println(this.getClass().getName() + ":: Forwarding message..."); if (message instanceof TextMessage) { try {/*w w w. j av a 2 s. c o m*/ ParcelEvent event = MyMarshaller.unmarshalEvent((TextMessage) message); EventService.publishEventToTopic(event); } catch (JMSException e) { e.printStackTrace(); } catch (JAXBException e) { e.printStackTrace(); } } else { System.out.println("EventQueueListener NOT TEXT MESSSAGE"); } }
From source file:com.oracle.demo.ops.jms.listener.shipment.NewShipmentMessageListenerMDP.java
@Override public void onMessage(Message message) { System.out.println("NewShipmentMessageListener.onMessage - Thread: " + Thread.currentThread().getName()); if (message instanceof TextMessage) { TextMessage txtMessage = (TextMessage) message; try {//w w w . j a va2 s . co m Shipment shipment = MyMarshaller.unmarshallShipment(txtMessage); shipmentManager.createShipment(shipment); } catch (JMSException e) { e.printStackTrace(); } catch (JAXBException e) { e.printStackTrace(); } } }
From source file:com.jim.im.group.rpc.UserRegisterListener.java
@Override public void onMessage(Message arg0) { BytesMessage bytesmsg = (BytesMessage) arg0; int length;//from w ww . j a v a2 s .c o m try { length = (int) bytesmsg.getBodyLength(); byte[] bytes = new byte[length]; bytesmsg.readBytes(bytes); // ProtocolStream stream = new ProtocolStream(bytes); // registerobj obj = registerobjSerializer.getregisterobj(stream); User user = new User(); Integer usernumber = 1; user.setGatewayUserId(usernumber); user.setAppId("sfa"); user.setTenantId("hengda"); userService.createUser(user); logger.info("UserRegisterListener.onMessage arrived user :" + usernumber); } catch (JMSException e) { e.printStackTrace(); } catch (ImException e) { e.printStackTrace(); } }
From source file:be.anova.courses.activemq.MessageTimerTask.java
public void onMessage(Message message) { try {//w w w .j a v a 2 s. co m if (message instanceof TextMessage) { String command = ((TextMessage) message).getText(); if (command.contains("timer")) { onTimerCommand(command); } } } catch (JMSException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } }
From source file:Retailer.java
public void run() { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url); try {/* w w w. ja v a2s .c om*/ Connection connection = connectionFactory.createConnection(); // The Retailer's session is non-trasacted. Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination vendorOrderQueue = session.createQueue("VendorOrderQueue"); TemporaryQueue retailerConfirmQueue = session.createTemporaryQueue(); MessageProducer producer = session.createProducer(vendorOrderQueue); MessageConsumer replyConsumer = session.createConsumer(retailerConfirmQueue); connection.start(); for (int i = 0; i < 5; i++) { MapMessage message = session.createMapMessage(); message.setString("Item", "Computer(s)"); int quantity = (int) (Math.random() * 4) + 1; message.setInt("Quantity", quantity); message.setJMSReplyTo(retailerConfirmQueue); producer.send(message); System.out.println("Retailer: Ordered " + quantity + " computers."); MapMessage reply = (MapMessage) replyConsumer.receive(); if (reply.getBoolean("OrderAccepted")) { System.out.println("Retailer: Order Filled"); } else { System.out.println("Retailer: Order Not Filled"); } } // Send a non-MapMessage to signal the end producer.send(session.createMessage()); replyConsumer.close(); connection.close(); } catch (JMSException e) { e.printStackTrace(); } }
From source file:de.fzi.ALERT.actor.MessageObserver.PatternObserver.JMSPatternListener.java
public void onMessage(Message msg) { if ((msg instanceof TextMessage)) { TextMessage tMsg = (TextMessage) msg; try {//from w ww. j a va 2s . c om Pattern pattern = this.parser.parseJsoup(tMsg.getText()); System.out.println("Get a new Pattern with ID: " + pattern.getPatternID()); System.out.println("Get a new Pattern with name: " + pattern.getPatternName()); System.out.println("The Action is " + pattern.getStatus()); if (pattern.getPatternID() == null || pattern.getPatternName() == null) { System.out.println("pattern id and name can't be null!!"); return; } switch (pattern.getStatus()) { case 0: this.manager.savePattern(pattern); break; case 1: this.manager.updatePattern(pattern); break; case 2: this.manager.deletePattern(pattern); break; default: System.out.println("The wrong action type!"); } } catch (JMSException e) { e.printStackTrace(); } } }
From source file:eu.learnpad.simulator.mon.example.MyGlimpseProbe_BPMN_LearnPAd.java
private void generateAndSendExample_GlimpseBaseEvents_StringPayload(String data, int sendingInterval) throws UnknownHostException { DebugMessages.ok();//w ww.java 2s .co m DebugMessages.print(TimeStamp.getCurrentTime(), MyGlimpseProbe_BPMN_LearnPAd.class.getName(), "Creating GlimpseBaseEventBPMN message"); GlimpseBaseEventBPMN<String> message; DebugMessages.ok(); DebugMessages.line(); try { AbstractEvent theEvent = new SessionScoreUpdateEvent(); for (int i = 0; i < 1000; i++) { Vector<Learner> usersInvolved = new Vector<>(); usersInvolved.add(new Learner(1, 12, "testName1", "testSurname1")); usersInvolved.add(new Learner(2, 24, "testName2", "testSurname2")); message = new GlimpseBaseEventBPMN<String>(data, "aGenericProbe", System.currentTimeMillis(), "EventGeneratedFromActivitiEngineSimulated", false, "ExtraField", theEvent); this.sendEventMessage(message, false); DebugMessages.println(TimeStamp.getCurrentTime(), MyGlimpseProbe_BPMN_LearnPAd.class.getName(), "GlimpseBaseEventBPMN message sent: {\n" + "eventName: " + message.getEventName() + "\n" + "eventData: " + message.getEventData() + "\n" + "timestamp: " + message.getTimeStamp() + "\n" + "extraField: " + message.getExtraDataField() + "\n" + "sessionID_Field: " + message.event.simulationsessionid + "\n" + "usersInvolvedSize: " + message.event.involvedusers + "\n" + "eventType: " + message.event.type + "}"); DebugMessages.line(); Thread.sleep(sendingInterval); } } catch (JMSException e1) { e1.printStackTrace(); } catch (NamingException e1) { e1.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:org.panksdmz.jms.tibco.MessageSenderBean.java
public void send() { try {// w w w. ja v a 2s. c om QueueConnection connection = connectionFactory.createQueueConnection(); QueueSession session = connection.createQueueSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue(sendQueueName); QueueSender sender = session.createSender(queue); TextMessage message = session .createTextMessage("Message @ " + CaliHDateTime.now().getTimeInMillis() + " from thread " + Thread.currentThread().getId() + " from session [" + session.toString() + "]"); sender.send(message); session.close(); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } }