List of usage examples for javax.jms TextMessage getText
String getText() throws JMSException;
From source file:org.wso2.mb.integration.tests.amqp.functional.PerMessageAcknowledgementsTestCase.java
/** * This test publishes 1000 messages and the subscriber reject each 100th message and then wait for the redelivered * message./* ww w .j a v a 2 s .c o m*/ * * @throws AndesClientConfigurationException * @throws XPathExpressionException * @throws IOException * @throws JMSException * @throws AndesClientException * @throws NamingException */ @Test(groups = { "wso2.mb", "queue" }) public void oneByOneUnacknowledgeMessageListenerForMultipleMessagesPerAckTestCase() throws AndesClientConfigurationException, XPathExpressionException, IOException, JMSException, AndesClientException, NamingException { long sendCount = 1000; final List<String> receivedMessages = new ArrayList<>(); // Creating a consumer client configuration AndesJMSConsumerClientConfiguration consumerConfig = new AndesJMSConsumerClientConfiguration(getAMQPPort(), ExchangeType.QUEUE, "oneByOneUnacknowledgeQueuePerAckMultiple"); consumerConfig.setAcknowledgeMode(JMSAcknowledgeMode.PER_MESSAGE_ACKNOWLEDGE); consumerConfig.setAsync(false); // Creating a publisher client configuration AndesJMSPublisherClientConfiguration publisherConfig = new AndesJMSPublisherClientConfiguration( getAMQPPort(), ExchangeType.QUEUE, "oneByOneUnacknowledgeQueuePerAckMultiple"); publisherConfig.setNumberOfMessagesToSend(sendCount); // Creating clients AndesClient consumerClient = new AndesClient(consumerConfig, true); final AndesJMSConsumer andesJMSConsumer = consumerClient.getConsumers().get(0); MessageConsumer receiver = andesJMSConsumer.getReceiver(); receiver.setMessageListener(new MessageListener() { @Override public void onMessage(Message message) { try { TextMessage textMessage = (TextMessage) message; if (Integer.parseInt(textMessage.getText().split("#")[1]) % 100 != 0 || receivedMessages.contains(textMessage.getText())) { message.acknowledge(); } receivedMessages.add(textMessage.getText()); andesJMSConsumer.getReceivedMessageCount().incrementAndGet(); } catch (JMSException e) { throw new RuntimeException("Exception occurred when receiving messages.", e); } } }); AndesClient publisherClient = new AndesClient(publisherConfig, true); MessageProducer sender = publisherClient.getPublishers().get(0).getSender(); for (int i = 0; i < sendCount; i++) { TextMessage textMessage = publisherClient.getPublishers().get(0).getSession() .createTextMessage("#" + Integer.toString(i)); sender.send(textMessage); } AndesClientUtils.waitForMessagesAndShutdown(consumerClient, AndesClientConstants.DEFAULT_RUN_TIME * 2); log.info("Received Messages : " + receivedMessages); for (int i = 0; i < sendCount; i++) { Assert.assertEquals(receivedMessages.get(i), "#" + Integer.toString(i), "Invalid messages received. #" + Integer.toString(i) + " expected."); } Assert.assertEquals(receivedMessages.get(1000), "#0", "Invalid messages received."); Assert.assertEquals(receivedMessages.get(1001), "#100", "Invalid messages received."); Assert.assertEquals(receivedMessages.get(1002), "#200", "Invalid messages received."); Assert.assertEquals(receivedMessages.get(1003), "#300", "Invalid messages received."); Assert.assertEquals(receivedMessages.get(1004), "#400", "Invalid messages received."); Assert.assertEquals(receivedMessages.get(1005), "#500", "Invalid messages received."); Assert.assertEquals(receivedMessages.get(1006), "#600", "Invalid messages received."); Assert.assertEquals(receivedMessages.get(1007), "#700", "Invalid messages received."); Assert.assertEquals(receivedMessages.get(1008), "#800", "Invalid messages received."); Assert.assertEquals(receivedMessages.get(1009), "#900", "Invalid messages received."); Assert.assertEquals(receivedMessages.size(), sendCount + 10, "Message receiving failed."); }
From source file:org.wso2.mb.integration.tests.amqp.functional.PerMessageAcknowledgementsTestCase.java
/** * This test publishes 10 messages and the subscriber rejects all message and then wait for the redelivered * message.//from w w w . j a va 2s.c o m * * @throws AndesClientConfigurationException * @throws XPathExpressionException * @throws IOException * @throws JMSException * @throws AndesClientException * @throws NamingException */ @Test(groups = { "wso2.mb", "queue" }) public void allUnacknowledgeMessageListenerPerAckTestCase() throws AndesClientConfigurationException, XPathExpressionException, IOException, JMSException, AndesClientException, NamingException { long sendCount = 10; final List<String> receivedMessages = new ArrayList<>(); // Creating a consumer client configuration AndesJMSConsumerClientConfiguration consumerConfig = new AndesJMSConsumerClientConfiguration(getAMQPPort(), ExchangeType.QUEUE, "allUnacknowledgePerAckQueue"); consumerConfig.setAcknowledgeMode(JMSAcknowledgeMode.PER_MESSAGE_ACKNOWLEDGE); consumerConfig.setAsync(false); // Creating a publisher client configuration AndesJMSPublisherClientConfiguration publisherConfig = new AndesJMSPublisherClientConfiguration( getAMQPPort(), ExchangeType.QUEUE, "allUnacknowledgePerAckQueue"); publisherConfig.setNumberOfMessagesToSend(sendCount); // Creating clients AndesClient consumerClient = new AndesClient(consumerConfig, true); final AndesJMSConsumer andesJMSConsumer = consumerClient.getConsumers().get(0); MessageConsumer receiver = andesJMSConsumer.getReceiver(); receiver.setMessageListener(new MessageListener() { @Override public void onMessage(Message message) { try { TextMessage textMessage = (TextMessage) message; if (receivedMessages.contains(textMessage.getText())) { message.acknowledge(); } receivedMessages.add(textMessage.getText()); andesJMSConsumer.getReceivedMessageCount().incrementAndGet(); } catch (JMSException e) { throw new RuntimeException("Exception occurred when receiving messages.", e); } } }); AndesClient publisherClient = new AndesClient(publisherConfig, true); MessageProducer sender = publisherClient.getPublishers().get(0).getSender(); for (int i = 0; i < sendCount; i++) { TextMessage textMessage = publisherClient.getPublishers().get(0).getSession() .createTextMessage("#" + Integer.toString(i)); sender.send(textMessage); } AndesClientUtils.waitForMessagesAndShutdown(consumerClient, AndesClientConstants.DEFAULT_RUN_TIME); log.info("Received Messages : " + receivedMessages); for (int i = 0; i < sendCount * 2; i++) { if (i < sendCount) { Assert.assertEquals(receivedMessages.get(i), "#" + Integer.toString(i), "Invalid messages received. " + "#" + Integer.toString(i) + "" + " expected."); } else { Assert.assertEquals(receivedMessages.get(i), "#" + Integer.toString(i - 10), "Invalid messages " + "received. #" + Integer.toString(i - 10) + " expected."); } } Assert.assertEquals(receivedMessages.size(), sendCount * 2, "Message receiving failed."); }
From source file:hermes.renderers.DefaultMessageRenderer.java
/** * Show the TextMessage in a JTextArea./* w w w .java 2 s . c o m*/ * * @param textMessage * @return * @throws JMSException */ protected JComponent handleTextMessage(final TextMessage textMessage) throws JMSException { // // Show the text in a JTextArea, you can edit the message in place and // then drop it onto another queue/topic. final String text = textMessage.getText(); final JTextArea textPane = new JTextArea(); // final CharBuffer bytes = CharBuffer.wrap(text.subSequence(0, // text.length())) ; // final JTextArea textPane = new MyTextArea(new PlainDocument(new // MappedStringContent(bytes))) ; textPane.setEditable(false); textPane.setFont(Font.decode("Monospaced-PLAIN-12")); textPane.setLineWrap(true); textPane.setWrapStyleWord(true); textPane.append(text); textPane.getDocument().addDocumentListener(new DocumentListener() { public void doChange() { try { textMessage.setText(textPane.getText()); } catch (JMSException e) { JOptionPane.showMessageDialog(textPane, "Unable to update the TextMessage: " + e.getMessage(), "Error modifying message content", JOptionPane.ERROR_MESSAGE); try { textPane.setText(textMessage.getText()); } catch (JMSException e1) { log.error(e1.getMessage(), e1); } textPane.setEditable(false); textPane.getDocument().removeDocumentListener(this); } } @Override public void changedUpdate(DocumentEvent arg0) { doChange(); } @Override public void insertUpdate(DocumentEvent arg0) { doChange(); } @Override public void removeUpdate(DocumentEvent arg0) { doChange(); } }); textPane.setCaretPosition(0); return textPane; }
From source file:org.wso2.mb.integration.tests.amqp.functional.PerMessageAcknowledgementsTestCase.java
/** * This test publishes 10 messages and the subscriber rejects the first message and then wait for the redelivered * message.//from w ww .ja v a2s. c o m * * @throws AndesClientConfigurationException * @throws XPathExpressionException * @throws IOException * @throws JMSException * @throws AndesClientException * @throws NamingException */ @Test(groups = { "wso2.mb", "queue" }) public void firstMessageInvalidOnlyPerAckQueueMessageListenerTestCase() throws AndesClientConfigurationException, XPathExpressionException, IOException, JMSException, AndesClientException, NamingException { long sendCount = 10; final List<String> receivedMessages = new ArrayList<>(); // Creating a consumer client configuration AndesJMSConsumerClientConfiguration consumerConfig = new AndesJMSConsumerClientConfiguration(getAMQPPort(), ExchangeType.QUEUE, "firstMessageInvalidOnlyPerAckQueue"); consumerConfig.setAcknowledgeMode(JMSAcknowledgeMode.PER_MESSAGE_ACKNOWLEDGE); consumerConfig.setAsync(false); // Creating a publisher client configuration AndesJMSPublisherClientConfiguration publisherConfig = new AndesJMSPublisherClientConfiguration( getAMQPPort(), ExchangeType.QUEUE, "firstMessageInvalidOnlyPerAckQueue"); publisherConfig.setNumberOfMessagesToSend(sendCount); publisherConfig.setPrintsPerMessageCount(sendCount / 10L); // Creating clients AndesClient consumerClient = new AndesClient(consumerConfig, true); final AndesJMSConsumer andesJMSConsumer = consumerClient.getConsumers().get(0); MessageConsumer receiver = andesJMSConsumer.getReceiver(); receiver.setMessageListener(new MessageListener() { private boolean receivedFirstMessage = false; @Override public void onMessage(Message message) { try { TextMessage textMessage = (TextMessage) message; if (!receivedFirstMessage && "#0".equals(textMessage.getText())) { receivedFirstMessage = true; } else { message.acknowledge(); } receivedMessages.add(textMessage.getText()); andesJMSConsumer.getReceivedMessageCount().incrementAndGet(); } catch (JMSException e) { throw new RuntimeException("Exception occurred when receiving messages.", e); } } }); AndesClient publisherClient = new AndesClient(publisherConfig, true); MessageProducer sender = publisherClient.getPublishers().get(0).getSender(); for (int i = 0; i < sendCount; i++) { TextMessage textMessage = publisherClient.getPublishers().get(0).getSession() .createTextMessage("#" + Integer.toString(i)); sender.send(textMessage); } AndesClientUtils.waitForMessagesAndShutdown(consumerClient, AndesClientConstants.DEFAULT_RUN_TIME); log.info("Received Messages : " + receivedMessages); for (int i = 0; i < sendCount; i++) { Assert.assertEquals(receivedMessages.get(i), "#" + Integer.toString(i), "Invalid messages received. #" + Integer.toString(i) + " expected."); } Assert.assertEquals(receivedMessages.get(10), "#0", "Invalid messages received. #0 expected."); Assert.assertEquals(receivedMessages.size(), sendCount + 1, "Message receiving failed."); }
From source file:com.oneops.controller.jms.CmsListener.java
private void processMessage(TextMessage message) throws JsonSyntaxException, JMSException { String source = message.getStringProperty("source"); logger.info("Message from source: " + source); String processKey;//from ww w . j a v a2s .c o m String pokeActivitiProcessId = null; Map<String, Object> wfParams = new HashMap<String, Object>(); if (source.equals("deployment")) { CmsDeployment dpmt = gson.fromJson(message.getText(), CmsDeployment.class); if (dpmt == null) { logger.error("Got bad message:" + message.getText() + "/n end msg"); return; } else { if (isDeployerEnabled(dpmt.getNsPath()) && cmsClient.isDeployerStepsInLimit(dpmt.getDeploymentId())) { notifyIfRequired(dpmt); logger.info("Executing deployment using Deployer : " + dpmt.getDeploymentId()); startDeployment(dpmt); } else { logger.info("Executing deployment using activiti : " + dpmt.getDeploymentId()); processKey = getDpmtProcessKey(dpmt); if (processKey != null && !processKey.equals("skip")) { wfParams.put("dpmt", dpmt); wfParams.put("execOrder", 1); pokeActivitiProcessId = wfController.startDpmtProcess(processKey, wfParams); } else { notifyIfRequired(dpmt); } } } } else if (source.equals("opsprocedure")) { CmsOpsProcedure proc = gson.fromJson(message.getText(), CmsOpsProcedure.class); if (proc == null) { logger.error("Got bad message:" + message.getText() + "/n end msg"); return; } //logger.info() if (isProcDeployerEnabled(proc.getNsPath())) { logger.info("Executing procedure using ProcedureRunner : " + proc.getProcedureId()); startProcedure(proc); } else { processKey = getOpsProcedureProcessKey(proc); if (processKey != null && !processKey.equals("skip")) { wfParams.put("proc", proc); wfParams.put("execOrder", 1); } else { return; } pokeActivitiProcessId = wfController.startOpsProcess(processKey, wfParams); } } else if (source.equals("release")) { CmsRelease release = gson.fromJson(message.getText(), CmsRelease.class); if (release == null) { logger.error("Got bad message:" + message.getText() + "/n end msg"); return; } processKey = getDeployReleaseProcessKey(release); if (processKey != null && !processKey.equals("skip")) { wfParams.put("release", release); } else { return; } pokeActivitiProcessId = wfController.startReleaseProcess(processKey, wfParams); } else { logger.error("Unsupported source:" + source); return; } if (pokeActivitiProcessId != null) { wfController.pokeProcess(pokeActivitiProcessId); } }
From source file:org.wso2.mb.integration.tests.amqp.functional.PerMessageAcknowledgementsTestCase.java
/** * This test publishes 1000 messages and the subscriber accepts all message and then wait for the redelivered * message.//from w ww . ja v a2 s . c om * * @throws AndesClientConfigurationException * @throws XPathExpressionException * @throws IOException * @throws JMSException * @throws AndesClientException * @throws NamingException */ @Test(groups = { "wso2.mb", "queue" }) public void allAcknowledgeMessageListenerForMultipleMessagesTestCase() throws AndesClientConfigurationException, XPathExpressionException, IOException, JMSException, AndesClientException, NamingException { long sendCount = 1000; final List<String> receivedMessages = new ArrayList<>(); // Creating a consumer client configuration AndesJMSConsumerClientConfiguration consumerConfig = new AndesJMSConsumerClientConfiguration(getAMQPPort(), ExchangeType.QUEUE, "allAcknowledgeMultiplePerAckQueue"); consumerConfig.setAcknowledgeMode(JMSAcknowledgeMode.PER_MESSAGE_ACKNOWLEDGE); consumerConfig.setAsync(false); // Creating a publisher client configuration AndesJMSPublisherClientConfiguration publisherConfig = new AndesJMSPublisherClientConfiguration( getAMQPPort(), ExchangeType.QUEUE, "allAcknowledgeMultiplePerAckQueue"); publisherConfig.setNumberOfMessagesToSend(sendCount); // Creating clients AndesClient consumerClient = new AndesClient(consumerConfig, true); final AndesJMSConsumer andesJMSConsumer = consumerClient.getConsumers().get(0); MessageConsumer receiver = andesJMSConsumer.getReceiver(); receiver.setMessageListener(new MessageListener() { @Override public void onMessage(Message message) { try { TextMessage textMessage = (TextMessage) message; message.acknowledge(); receivedMessages.add(textMessage.getText()); andesJMSConsumer.getReceivedMessageCount().incrementAndGet(); } catch (JMSException e) { throw new RuntimeException("Exception occurred when receiving messages.", e); } } }); AndesClient publisherClient = new AndesClient(publisherConfig, true); MessageProducer sender = publisherClient.getPublishers().get(0).getSender(); for (int i = 0; i < sendCount; i++) { TextMessage textMessage = publisherClient.getPublishers().get(0).getSession() .createTextMessage("#" + Integer.toString(i)); sender.send(textMessage); } AndesClientUtils.waitForMessagesAndShutdown(consumerClient, AndesClientConstants.DEFAULT_RUN_TIME * 2); log.info("Received Messages : " + receivedMessages); for (int i = 0; i < sendCount; i++) { Assert.assertEquals(receivedMessages.get(i), "#" + Integer.toString(i), "Invalid messages received. #" + Integer.toString(i) + " expected."); } Assert.assertEquals(receivedMessages.size(), sendCount, "Message receiving failed."); }
From source file:org.aludratest.service.jms.JmsActionImplTest.java
@Test public void testBasicJms() { String queueName = queues[0]; String textContent = UUID.randomUUID().toString(); try {// w w w .ja v a 2 s. co m LOGGER.info("Begin testBasicJms"); LOGGER.info("Creating and sending TextMessage to queue " + queueName); TextMessage sentMessage = perform.createTextMessage(); sentMessage.setText(textContent); perform.sendMessage(sentMessage, queueName); LOGGER.info("Receiving TextMessage from queue " + queueName); Message receivedMessage = perform.receiveMessage(queues[0], 20); Assert.assertNotNull(receivedMessage); Assert.assertTrue(receivedMessage instanceof TextMessage); Assert.assertTrue( StringUtils.equalsIgnoreCase(sentMessage.getText(), ((TextMessage) receivedMessage).getText())); LOGGER.info("End testBasicJms"); } catch (Exception e) { Assert.fail("Failed on testBasicJms " + " : " + e.getMessage()); } }
From source file:org.openengsb.ports.jms.JMSPortTest.java
private String sendWithTempQueue(final String msg) { String resultString = jmsTemplate.execute(new SessionCallback<String>() { @Override/* www.j a v a 2 s . co m*/ public String doInJms(Session session) throws JMSException { Queue queue = session.createQueue("receive"); MessageProducer producer = session.createProducer(queue); TemporaryQueue tempQueue = session.createTemporaryQueue(); MessageConsumer consumer = session.createConsumer(tempQueue); TextMessage message = session.createTextMessage(msg); message.setJMSReplyTo(tempQueue); producer.send(message); TextMessage response = (TextMessage) consumer.receive(10000); assertThat( "server should set the value of the correltion ID to the value of the received message id", response.getJMSCorrelationID(), is(message.getJMSMessageID())); JmsUtils.closeMessageProducer(producer); JmsUtils.closeMessageConsumer(consumer); return response != null ? response.getText() : null; } }, true); return resultString; }
From source file:nl.nn.adapterframework.extensions.tibco.GetTibcoQueues.java
private String getQueueMessage(Session jSession, TibjmsAdmin admin, String queueName, int queueItem, LdapSender ldapSender) throws TibjmsAdminException, JMSException { QueueInfo qInfo = admin.getQueue(queueName); if (qInfo == null) { throw new JMSException(" queue [" + queueName + "] does not exist"); }// ww w. j a v a 2 s . com XmlBuilder qMessageXml = new XmlBuilder("qMessage"); ServerInfo serverInfo = admin.getInfo(); String url = serverInfo.getURL(); qMessageXml.addAttribute("url", url); String resolvedUrl = getResolvedUrl(url); if (resolvedUrl != null) { qMessageXml.addAttribute("resolvedUrl", resolvedUrl); } qMessageXml.addAttribute("timestamp", DateUtils.getIsoTimeStamp()); qMessageXml.addAttribute("startTime", DateUtils.format(serverInfo.getStartTime(), DateUtils.fullIsoFormat)); XmlBuilder qNameXml = new XmlBuilder("qName"); qNameXml.setCdataValue(queueName); Queue queue = jSession.createQueue(queueName); QueueBrowser queueBrowser = null; try { queueBrowser = jSession.createBrowser(queue); Enumeration enm = queueBrowser.getEnumeration(); int count = 0; boolean found = false; String chompCharSizeString = AppConstants.getInstance().getString("browseQueue.chompCharSize", null); int chompCharSize = (int) Misc.toFileSize(chompCharSizeString, -1); while (enm.hasMoreElements() && !found) { count++; if (count == queueItem) { qNameXml.addAttribute("item", count); Object o = enm.nextElement(); if (o instanceof Message) { Message msg = (Message) o; XmlBuilder qMessageId = new XmlBuilder("qMessageId"); qMessageId.setCdataValue(msg.getJMSMessageID()); qMessageXml.addSubElement(qMessageId); XmlBuilder qTimestamp = new XmlBuilder("qTimestamp"); qTimestamp.setCdataValue(DateUtils.format(msg.getJMSTimestamp(), DateUtils.fullIsoFormat)); qMessageXml.addSubElement(qTimestamp); StringBuffer sb = new StringBuffer(""); Enumeration propertyNames = msg.getPropertyNames(); while (propertyNames.hasMoreElements()) { String propertyName = (String) propertyNames.nextElement(); Object object = msg.getObjectProperty(propertyName); if (sb.length() > 0) { sb.append("; "); } sb.append(propertyName); sb.append("="); sb.append(object); } XmlBuilder qPropsXml = new XmlBuilder("qProps"); qPropsXml.setCdataValue(sb.toString()); qMessageXml.addSubElement(qPropsXml); XmlBuilder qTextXml = new XmlBuilder("qText"); String msgText; try { TextMessage textMessage = (TextMessage) msg; msgText = textMessage.getText(); } catch (ClassCastException e) { msgText = msg.toString(); qTextXml.addAttribute("text", false); } int msgSize = msgText.length(); if (isHideMessage()) { qTextXml.setCdataValue("***HIDDEN***"); } else { if (chompCharSize >= 0 && msgSize > chompCharSize) { qTextXml.setCdataValue(msgText.substring(0, chompCharSize) + "..."); qTextXml.addAttribute("chomped", true); } else { qTextXml.setCdataValue(msgText); } } qMessageXml.addSubElement(qTextXml); XmlBuilder qTextSizeXml = new XmlBuilder("qTextSize"); qTextSizeXml.setValue(Misc.toFileSize(msgSize)); qMessageXml.addSubElement(qTextSizeXml); } found = true; } else { enm.nextElement(); } } } finally { if (queueBrowser != null) { try { queueBrowser.close(); } catch (JMSException e) { log.warn(getLogPrefix(null) + "exception on closing queue browser", e); } } } qMessageXml.addSubElement(qNameXml); Map aclMap = getAclMap(admin, ldapSender); XmlBuilder aclXml = new XmlBuilder("acl"); XmlBuilder qInfoXml = qInfoToXml(qInfo); aclXml.setValue((String) aclMap.get(qInfo.getName())); qInfoXml.addSubElement(aclXml); qMessageXml.addSubElement(qInfoXml); Map consumersMap = getConnectedConsumersMap(admin); XmlBuilder consumerXml = new XmlBuilder("connectedConsumers"); if (consumersMap.containsKey(qInfo.getName())) { LinkedList<String> consumers = (LinkedList<String>) consumersMap.get(qInfo.getName()); String consumersString = listToString(consumers); if (consumersString != null) { consumerXml.setCdataValue(consumersString); } } qInfoXml.addSubElement(consumerXml); return qMessageXml.toXML(); }
From source file:com.oneops.controller.jms.InductorPublisher.java
/** * Publish message.//w w w . ja v a 2 s . c o m * * @param waitTaskName the wait task name * @param woType the wo type * @throws JMSException the jMS exception */ public void publishMessage(String processId, String execId, CmsWorkOrderSimpleBase wo, String waitTaskName, String woType) throws JMSException { SimpleDateFormat format = new SimpleDateFormat(CmsConstants.SEARCH_TS_PATTERN); wo.getSearchTags().put(CmsConstants.REQUEST_ENQUE_TS, format.format(new Date())); //guarantee non empty-value for searchMap if (version != null && StringUtils.isNotBlank(version.getGitVersion())) { wo.getSearchTags().put(CONTROLLLER_VERSION_SEARCH_TAG, version.getGitVersion()); } else { wo.getSearchTags().put(CONTROLLLER_VERSION_SEARCH_TAG, DEFAULT_VERSION); } TextMessage message = session.createTextMessage(gson.toJson(wo)); String corelationId = processId + "!" + execId + "!" + waitTaskName + "!" + getCtxtId(wo); message.setJMSCorrelationID(corelationId); message.setStringProperty("task_id", corelationId); message.setStringProperty("type", woType); String queueName = getQueue(wo); bindingQueusMap.computeIfAbsent(queueName, k -> { try { return newMessageProducer(k); } catch (JMSException e) { throw new RuntimeException(e); } }).send(message); if (logger.isDebugEnabled()) { logger.debug("Published: " + message.getText()); } logger.info("Posted message with id " + corelationId + " to q: " + queueName); }