/** * Extract the topic from the {@link Message} looking for Kapua header property that handles this value and inspecting Camel header properties) * * @param message * @return * @throws JMSException */ public static String getTopic(org.apache.camel.Message message) throws JMSException { String topicOrig = message.getHeader(MessageConstants.PROPERTY_ORIGINAL_TOPIC, String.class); if (topicOrig != null) { return topicOrig; } else { ActiveMQDestination destination = message.getHeader(CamelConstants.JMS_HEADER_DESTINATION, ActiveMQDestination.class); if (destination instanceof ActiveMQTopic) { ActiveMQTopic destinationTopic = (ActiveMQTopic) destination; return destinationTopic.getTopicName().substring(KapuaSecurityBrokerFilter.VT_TOPIC_PREFIX.length()); } else { logger.warn("jmsMessage destination is not a Topic or Queue: {}", destination); throw new JMSException(String.format("Unable to extract the destination. Wrong destination %s", destination)); } } }
protected void executeListQueues(final CommandLine cmdLine) throws JMSException { if (conn instanceof org.apache.activemq.ActiveMQConnection) { final org.apache.activemq.ActiveMQConnection amqConn = (org.apache.activemq.ActiveMQConnection) conn; final Set<ActiveMQQueue> queues = amqConn.getDestinationSource() .getQueues(); final Set<ActiveMQTopic> topics = amqConn.getDestinationSource() .getTopics(); if (!queues.isEmpty()) { output("Queues:"); for (ActiveMQQueue q : queues) { output(q.getPhysicalName()); } } if (!topics.isEmpty()) { output("Topics:"); for (ActiveMQTopic t : topics) { output(t.getTopicName()); } } } else { throw new RuntimeException( "Only ActiveMQ 5.x connections support listing queues"); } }
jsonMap.put("name", sub.getClientId() + ":" + sub.getSubscriptionName()); HashMap<String, Object> jsonTopic = new HashMap<String, Object>(); jsonTopic.put("name", dest.getTopicName()); jsonMap.put("topics", new Object[]{jsonTopic}); if (sub.getSelector() != null) {
jsonMap.put("name", sub.getClientId() + ":" + sub.getSubscriptionName()); HashMap<String, Object> jsonTopic = new HashMap<String, Object>(); jsonTopic.put("name", dest.getTopicName()); jsonMap.put("topics", new Object[]{jsonTopic}); if (sub.getSelector() != null) {
jsonMap.put("name", sub.getClientId() + ":" + sub.getSubscriptionName()); HashMap<String, Object> jsonTopic = new HashMap<String, Object>(); jsonTopic.put("name", dest.getTopicName()); jsonMap.put("topics", new Object[]{jsonTopic}); if (sub.getSelector() != null) {
if (destination instanceof ActiveMQTopic) { ActiveMQTopic destinationTopic = (ActiveMQTopic) destination; messageSend.setProperty(MessageConstants.PROPERTY_ORIGINAL_TOPIC, destinationTopic.getTopicName().substring(VT_TOPIC_PREFIX.length()));