Refine search
@Override public void sendMessage(final String destination, final Integer pattern, final byte[] message) { Destination queue = new ActiveMQQueue(destination); if (Objects.equals(P2P.getCode(), pattern)) { queue = new ActiveMQQueue(destination); } else if (Objects.equals(TOPIC.getCode(), pattern)) { queue = new ActiveMQTopic(destination); } jmsTemplate.convertAndSend(queue, message); }
/** * Creates a destination. * * @param subject - topic or queue name. * @return Destination - either an ActiveMQTopic or ActiveMQQUeue. */ protected Destination createDestination(String subject) { if (topic) { return new ActiveMQTopic(subject); } else { return new ActiveMQQueue(subject); } }
public static ActiveMQDestination createDestination(String name, byte defaultType) { if (name.startsWith(QUEUE_QUALIFIED_PREFIX)) { return new ActiveMQQueue(name.substring(QUEUE_QUALIFIED_PREFIX.length())); } else if (name.startsWith(TOPIC_QUALIFIED_PREFIX)) { return new ActiveMQTopic(name.substring(TOPIC_QUALIFIED_PREFIX.length())); } else if (name.startsWith(TEMP_QUEUE_QUALIFED_PREFIX)) { return new ActiveMQTempQueue(name.substring(TEMP_QUEUE_QUALIFED_PREFIX.length())); } else if (name.startsWith(TEMP_TOPIC_QUALIFED_PREFIX)) { return new ActiveMQTempTopic(name.substring(TEMP_TOPIC_QUALIFED_PREFIX.length())); } switch (defaultType) { case QUEUE_TYPE: return new ActiveMQQueue(name); case TOPIC_TYPE: return new ActiveMQTopic(name); case TEMP_QUEUE_TYPE: return new ActiveMQTempQueue(name); case TEMP_TOPIC_TYPE: return new ActiveMQTempTopic(name); default: throw new IllegalArgumentException("Invalid default destination type: " + defaultType); } }
private void validatePolicyDelay(long limit) { final ActiveMQDestination matchAll = new AnyDestination(new ActiveMQDestination[]{new ActiveMQQueue(">"), new ActiveMQTopic(">")}); for (Object entry : redeliveryPolicyMap.get(matchAll)) { RedeliveryPolicy redeliveryPolicy = (RedeliveryPolicy) entry; validateLimit(limit, redeliveryPolicy); } RedeliveryPolicy defaultEntry = redeliveryPolicyMap.getDefaultEntry(); if (defaultEntry != null) { validateLimit(limit, defaultEntry); } }
ActiveMQDestination convert(String dest) { int p = dest.indexOf(":"); if( p<0 ) { throw new IllegalArgumentException("Not in the valid destination format"); } int type = Integer.parseInt(dest.substring(0, p)); String name = dest.substring(p+1); switch( KahaDestination.DestinationType.valueOf(type) ) { case QUEUE: return new ActiveMQQueue(name); case TOPIC: return new ActiveMQTopic(name); case TEMP_QUEUE: return new ActiveMQTempQueue(name); case TEMP_TOPIC: return new ActiveMQTempTopic(name); default: throw new IllegalArgumentException("Not in the valid destination format"); } }
private ActiveMQDestination convert(int type, String name) { switch (KahaDestination.DestinationType.valueOf(type)) { case QUEUE: return new ActiveMQQueue(name); case TOPIC: return new ActiveMQTopic(name); case TEMP_QUEUE: return new ActiveMQTempQueue(name); case TEMP_TOPIC: return new ActiveMQTempTopic(name); default: throw new IllegalArgumentException("Not in the valid destination format"); } }
dest = new ActiveMQQueue(formatDestinationName(destinationName)); break; case TOPIC: dest = new ActiveMQTopic(formatDestinationName(destinationName)); break; default:
@Override public ActiveMQDestination transform(Destination dest) throws JMSException { String queueName = ((Queue) dest).getQueueName(); String topicName = ((Topic) dest).getTopicName(); if (queueName == null && topicName == null) { throw new JMSException("Unresolvable destination: Both queue and topic names are null: " + dest); } try { Method isQueueMethod = dest.getClass().getMethod("isQueue"); Method isTopicMethod = dest.getClass().getMethod("isTopic"); Boolean isQueue = (Boolean) isQueueMethod.invoke(dest); Boolean isTopic = (Boolean) isTopicMethod.invoke(dest); if (isQueue) { return new ActiveMQQueue(queueName); } else if (isTopic) { return new ActiveMQTopic(topicName); } else { throw new JMSException("Unresolvable destination: Neither Queue nor Topic: " + dest); } } catch (Exception e) { throw new JMSException("Unresolvable destination: " + e.getMessage() + ": " + dest); } }
return new ActiveMQQueue(name); return new ActiveMQTopic(name);
String topicName = ((Topic) dest).getTopicName(); if (queueName != null && topicName == null) { return new ActiveMQQueue(queueName); } else if (queueName == null && topicName != null) { return new ActiveMQTopic(topicName); } else { return unresolvableDestinationTransformer.transform(dest); return new ActiveMQQueue(((Queue) dest).getQueueName()); return new ActiveMQTopic(((Topic) dest).getTopicName());
protected ActiveMQDestination createDestination(Message message, String prefix, String suffix, boolean useQueue, Subscription subscription ) { String name = null; Destination regionDestination = (Destination) message.getRegionDestination(); if (regionDestination != null && regionDestination.getActiveMQDestination() != null && regionDestination.getActiveMQDestination().getPhysicalName() != null && !regionDestination.getActiveMQDestination().getPhysicalName().isEmpty()){ name = prefix + regionDestination.getActiveMQDestination().getPhysicalName(); } else { name = prefix + message.getDestination().getPhysicalName(); } if (destinationPerDurableSubscriber && subscription instanceof DurableTopicSubscription) { name += "." + ((DurableTopicSubscription)subscription).getSubscriptionKey(); } if (suffix != null && !suffix.isEmpty()) { name += suffix; } if (useQueue) { return new ActiveMQQueue(name); } else { return new ActiveMQTopic(name); } }
@Override public void deleteAllMessages() throws IOException { for (PersistenceAdapter persistenceAdapter : adapters) { persistenceAdapter.deleteAllMessages(); } transactionStore.deleteAllMessages(); IOHelper.deleteChildren(getDirectory()); for (Object o : destinationMap.get(new AnyDestination(new ActiveMQDestination[]{new ActiveMQQueue(">"), new ActiveMQTopic(">")}))) { if (o instanceof FilteredKahaDBPersistenceAdapter) { FilteredKahaDBPersistenceAdapter filteredKahaDBPersistenceAdapter = (FilteredKahaDBPersistenceAdapter) o; if (filteredKahaDBPersistenceAdapter.getPersistenceAdapter().getDirectory() != DEFAULT_DIRECTORY) { IOHelper.deleteChildren(filteredKahaDBPersistenceAdapter.getPersistenceAdapter().getDirectory()); } if (filteredKahaDBPersistenceAdapter.getPersistenceAdapter() instanceof KahaDBPersistenceAdapter) { KahaDBPersistenceAdapter kahaDBPersistenceAdapter = (KahaDBPersistenceAdapter) filteredKahaDBPersistenceAdapter.getPersistenceAdapter(); if (kahaDBPersistenceAdapter.getIndexDirectory() != null) { IOHelper.deleteChildren(kahaDBPersistenceAdapter.getIndexDirectory()); } } } } }
queueConsumerInfo.setDestination(new ActiveMQQueue(destinationFilter)); queueConsumerInfo.setPrefetchSize(prefetchSize); queueConsumerInfo.setPriority(ConsumerInfo.NETWORK_CONSUMER_PRIORITY); topicConsumerInfo.setSubscriptionName("topic-bridge"); topicConsumerInfo.setRetroactive(true); topicConsumerInfo.setDestination(new ActiveMQTopic(destinationFilter)); topicConsumerInfo.setPrefetchSize(prefetchSize); topicConsumerInfo.setPriority(ConsumerInfo.NETWORK_CONSUMER_PRIORITY);
@Before public void setup() { ActiveMqTestUtils.prepare(); ActiveMQConnectionFactory targetConnectionFactory = new ActiveMQConnectionFactory(); targetConnectionFactory.setBrokerURL("vm://localhost?broker.persistent=false"); targetConnectionFactory.setTrustAllPackages(true); this.connectionFactory = new CachingConnectionFactory(targetConnectionFactory); this.topic = new ActiveMQTopic("testTopic"); this.queue = new ActiveMQQueue("testQueue"); }
public static Object inferTargetObject(Object elementContent) { if (DtoTopic.class.isAssignableFrom(elementContent.getClass())) { return new ActiveMQTopic(); } else if (DtoQueue.class.isAssignableFrom(elementContent.getClass())) { return new ActiveMQQueue(); } else if (DtoAuthenticationUser.class.isAssignableFrom(elementContent.getClass())) { return new AuthenticationUser(); } else if (DtoFilteredDestination.class.isAssignableFrom(elementContent.getClass())) { return new FilteredDestination(); } else { return new Object(); } }
private ActiveMQDestination createDestination(Object dto) throws Exception { if (dto instanceof DtoQueue) { return new ActiveMQQueue(((DtoQueue) dto).getPhysicalName()); } else if (dto instanceof DtoTopic) { return new ActiveMQTopic(((DtoTopic) dto).getPhysicalName()); } else { throw new Exception("Unknown destination type for DTO " + dto); } } }
public static ActiveMQDestination createDestination(String name, byte defaultType) { if (name.startsWith(QUEUE_QUALIFIED_PREFIX)) { return new ActiveMQQueue(name.substring(QUEUE_QUALIFIED_PREFIX.length())); } else if (name.startsWith(TOPIC_QUALIFIED_PREFIX)) { return new ActiveMQTopic(name.substring(TOPIC_QUALIFIED_PREFIX.length())); } else if (name.startsWith(TEMP_QUEUE_QUALIFED_PREFIX)) { return new ActiveMQTempQueue(name.substring(TEMP_QUEUE_QUALIFED_PREFIX.length())); } else if (name.startsWith(TEMP_TOPIC_QUALIFED_PREFIX)) { return new ActiveMQTempTopic(name.substring(TEMP_TOPIC_QUALIFED_PREFIX.length())); } switch (defaultType) { case QUEUE_TYPE: return new ActiveMQQueue(name); case TOPIC_TYPE: return new ActiveMQTopic(name); case TEMP_QUEUE_TYPE: return new ActiveMQTempQueue(name); case TEMP_TOPIC_TYPE: return new ActiveMQTempTopic(name); default: throw new IllegalArgumentException("Invalid default destination type: " + defaultType); } }
public static ActiveMQDestination createDestination(String name, byte defaultType) { if (name.startsWith(QUEUE_QUALIFIED_PREFIX)) { return new ActiveMQQueue(name.substring(QUEUE_QUALIFIED_PREFIX.length())); } else if (name.startsWith(TOPIC_QUALIFIED_PREFIX)) { return new ActiveMQTopic(name.substring(TOPIC_QUALIFIED_PREFIX.length())); } else if (name.startsWith(TEMP_QUEUE_QUALIFED_PREFIX)) { return new ActiveMQTempQueue(name.substring(TEMP_QUEUE_QUALIFED_PREFIX.length())); } else if (name.startsWith(TEMP_TOPIC_QUALIFED_PREFIX)) { return new ActiveMQTempTopic(name.substring(TEMP_TOPIC_QUALIFED_PREFIX.length())); } switch (defaultType) { case QUEUE_TYPE: return new ActiveMQQueue(name); case TOPIC_TYPE: return new ActiveMQTopic(name); case TEMP_QUEUE_TYPE: return new ActiveMQTempQueue(name); case TEMP_TOPIC_TYPE: return new ActiveMQTempTopic(name); default: throw new IllegalArgumentException("Invalid default destination type: " + defaultType); } }
private void validatePolicyDelay(long limit) { final ActiveMQDestination matchAll = new AnyDestination(new ActiveMQDestination[]{new ActiveMQQueue(">"), new ActiveMQTopic(">")}); for (Object entry : redeliveryPolicyMap.get(matchAll)) { RedeliveryPolicy redeliveryPolicy = (RedeliveryPolicy) entry; validateLimit(limit, redeliveryPolicy); } RedeliveryPolicy defaultEntry = redeliveryPolicyMap.getDefaultEntry(); if (defaultEntry != null) { validateLimit(limit, defaultEntry); } }
public static ActiveMQDestination createDestination(String name, byte defaultType) { if (name.startsWith(QUEUE_QUALIFIED_PREFIX)) { return new ActiveMQQueue(name.substring(QUEUE_QUALIFIED_PREFIX.length())); } else if (name.startsWith(TOPIC_QUALIFIED_PREFIX)) { return new ActiveMQTopic(name.substring(TOPIC_QUALIFIED_PREFIX.length())); } else if (name.startsWith(TEMP_QUEUE_QUALIFED_PREFIX)) { return new ActiveMQTempQueue(name.substring(TEMP_QUEUE_QUALIFED_PREFIX.length())); } else if (name.startsWith(TEMP_TOPIC_QUALIFED_PREFIX)) { return new ActiveMQTempTopic(name.substring(TEMP_TOPIC_QUALIFED_PREFIX.length())); } switch (defaultType) { case QUEUE_TYPE: return new ActiveMQQueue(name); case TOPIC_TYPE: return new ActiveMQTopic(name); case TEMP_QUEUE_TYPE: return new ActiveMQTempQueue(name); case TEMP_TOPIC_TYPE: return new ActiveMQTempTopic(name); default: throw new IllegalArgumentException("Invalid default destination type: " + defaultType); } }