/** * Creates a client-side representation of a JMS Topic. * * This method is deprecated. Use {@link org.apache.activemq.artemis.jms.client.ActiveMQSession#createTopic(String)} as that method will know the proper * prefix used at the target server. * * @param name the name of the topic * @return The Topic */ @Deprecated public static Topic createTopic(final String name) { if (DEFAULT_ENABLE_1X_PREFIXES) { return ActiveMQDestination.createTopic(PacketImpl.OLD_TOPIC_PREFIX + name, name); } else { return ActiveMQDestination.createTopic(name); } }
} else if (addr.startsWith(ActiveMQDestination.TOPIC_QUALIFIED_PREFIX)) { address = addr.substring(ActiveMQDestination.TOPIC_QUALIFIED_PREFIX.length()); destination = createTopic(address); } else if (addr.startsWith(ActiveMQDestination.TEMP_QUEUE_QUALIFED_PREFIX)) { address = addr.substring(ActiveMQDestination.TEMP_QUEUE_QUALIFED_PREFIX.length());
private ActiveMQTopic lookupTopic(final String topicName, final boolean isTemporary) throws ActiveMQException { String topicNameToUse = topicName; if (enable1xPrefixes) { topicNameToUse = (isTemporary ? PacketImpl.OLD_TEMP_TOPIC_PREFIX.toString() : PacketImpl.OLD_TOPIC_PREFIX.toString()) + topicName; } ActiveMQTopic topic; if (isTemporary) { topic = ActiveMQDestination.createTemporaryTopic(topicNameToUse); } else { topic = ActiveMQDestination.createTopic(topicNameToUse); } AddressQuery query = session.addressQuery(topic.getSimpleAddress()); if (!query.isExists() && !query.isAutoCreateAddresses()) { return null; } else { return topic; } }
@Override public Destination getJMSDestination() throws JMSException { if (dest == null) { SimpleString address = message.getAddressSimpleString(); SimpleString name = address; if (address != null & enable1xPrefixes) { dest = ActiveMQDestination.fromPrefixedName(get1xPrefixedName(address.toString())); } else { if (address == null) { dest = null; } else if (RoutingType.ANYCAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createQueue(address); } else if (RoutingType.MULTICAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createTopic(address); } else { dest = (ActiveMQDestination) ActiveMQDestination.fromPrefixedName(address.toString()); } if (name != null) { ((ActiveMQDestination) dest).setName(name.toString()); } } } return dest; }
/** * Creates a client-side representation of a JMS Topic. * * This method is deprecated. Use {@link org.apache.activemq.artemis.jms.client.ActiveMQSession#createTopic(String)} as that method will know the proper * prefix used at the target server. * * @param name the name of the topic * @return The Topic */ @Deprecated public static Topic createTopic(final String name) { if (DEFAULT_ENABLE_1X_PREFIXES) { return ActiveMQDestination.createTopic(PacketImpl.OLD_TOPIC_PREFIX + name, name); } else { return ActiveMQDestination.createTopic(name); } }
/** * Creates a client-side representation of a JMS Topic. * * This method is deprecated. Use {@link org.apache.activemq.artemis.jms.client.ActiveMQSession#createTopic(String)} as that method will know the proper * prefix used at the target server. * * @param name the name of the topic * @return The Topic */ @Deprecated public static Topic createTopic(final String name) { if (DEFAULT_ENABLE_1X_PREFIXES) { return ActiveMQDestination.createTopic(PacketImpl.OLD_TOPIC_PREFIX + name, name); } else { return ActiveMQDestination.createTopic(name); } }
/** * Creates a client-side representation of a JMS Topic. * * This method is deprecated. Use {@link org.apache.activemq.artemis.jms.client.ActiveMQSession#createTopic(String)} as that method will know the proper * prefix used at the target server. * * @param name the name of the topic * @return The Topic */ @Deprecated public static Topic createTopic(final String name) { if (DEFAULT_ENABLE_1X_PREFIXES) { return ActiveMQDestination.createTopic(PacketImpl.OLD_TOPIC_PREFIX + name, name); } else { return ActiveMQDestination.createTopic(name); } }
/** * Creates a client-side representation of a JMS Topic. * * This method is deprecated. Use {@link org.apache.activemq.artemis.jms.client.ActiveMQSession#createTopic(String)} as that method will know the proper * prefix used at the target server. * * @param name the name of the topic * @return The Topic */ @Deprecated public static Topic createTopic(final String name) { if (DEFAULT_ENABLE_1X_PREFIXES) { return ActiveMQDestination.createTopic(PacketImpl.OLD_TOPIC_PREFIX + name, name); } else { return ActiveMQDestination.createTopic(name); } }
@POST @Consumes("application/activemq.jms.topic+xml") public Response createJmsTopic(@Context UriInfo uriInfo, Document document) { ActiveMQRestLogger.LOGGER.debug("Handling POST request for \"" + uriInfo.getPath() + "\""); try { TopicConfiguration topic = FileJMSConfiguration.parseTopicConfiguration(document.getDocumentElement()); ActiveMQTopic activeMQTopic = ActiveMQDestination.createTopic(topic.getName()); String topicName = activeMQTopic.getAddress(); ClientSession session = manager.getSessionFactory().createSession(false, false, false); try { ClientSession.AddressQuery query = session.addressQuery(new SimpleString(topicName)); if (!query.isExists()) { session.createAddress(SimpleString.toSimpleString(topicName), RoutingType.MULTICAST, true); } else { throw new WebApplicationException(Response.status(412).type("text/plain").entity("Queue already exists.").build()); } } finally { try { session.close(); } catch (Exception ignored) { } } URI uri = uriInfo.getRequestUriBuilder().path(topicName).build(); return Response.created(uri).build(); } catch (Exception e) { if (e instanceof WebApplicationException) throw (WebApplicationException) e; throw new WebApplicationException(e, Response.serverError().type("text/plain").entity("Failed to create queue.").build()); } }
private synchronized boolean internalCreateTopic(final String address, final String topicName, final boolean autoCreated) throws Exception { if (topics.get(address) != null) { return false; } else { // Create the JMS topic with topicName as the logical name of the topic *and* address as its address ActiveMQTopic activeMQTopic = ActiveMQDestination.createTopic(address, topicName); server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.toSimpleString(activeMQTopic.getAddress()), RoutingType.MULTICAST)); topics.put(address, activeMQTopic); this.recoverregistryBindings(topicName, PersistedType.Topic); return true; } }
public static Destination fromPrefixed1XName(final String addr, final String name) { ActiveMQDestination destination; if (addr.startsWith(PacketImpl.OLD_QUEUE_PREFIX.toString())) { destination = createQueue(addr); } else if (addr.startsWith(PacketImpl.OLD_TOPIC_PREFIX.toString())) { destination = createTopic(addr); } else if (addr.startsWith(PacketImpl.OLD_TEMP_QUEUE_PREFIX.toString())) { destination = new ActiveMQTemporaryQueue(addr, null); } else if (addr.startsWith(PacketImpl.OLD_TEMP_TOPIC_PREFIX.toString())) { destination = new ActiveMQTemporaryTopic(addr, null); } else { destination = new ActiveMQDestination(addr, TYPE.DESTINATION, null); } String unprefixedName = name; if (name.startsWith(PacketImpl.OLD_QUEUE_PREFIX.toString())) { unprefixedName = name.substring(PacketImpl.OLD_QUEUE_PREFIX.length()); } else if (name.startsWith(PacketImpl.OLD_TOPIC_PREFIX.toString())) { unprefixedName = name.substring(PacketImpl.OLD_TOPIC_PREFIX.length()); } else if (name.startsWith(PacketImpl.OLD_TEMP_QUEUE_PREFIX.toString())) { unprefixedName = name.substring(PacketImpl.OLD_TEMP_QUEUE_PREFIX.length()); } else if (name.startsWith(PacketImpl.OLD_TEMP_TOPIC_PREFIX.toString())) { unprefixedName = name.substring(PacketImpl.OLD_TEMP_TOPIC_PREFIX.length()); } destination.setName(unprefixedName); return destination; }
public static Destination fromPrefixed1XName(final String addr, final String name) { ActiveMQDestination destination; if (addr.startsWith(PacketImpl.OLD_QUEUE_PREFIX.toString())) { destination = createQueue(addr); } else if (addr.startsWith(PacketImpl.OLD_TOPIC_PREFIX.toString())) { destination = createTopic(addr); } else if (addr.startsWith(PacketImpl.OLD_TEMP_QUEUE_PREFIX.toString())) { destination = new ActiveMQTemporaryQueue(addr, null); } else if (addr.startsWith(PacketImpl.OLD_TEMP_TOPIC_PREFIX.toString())) { destination = new ActiveMQTemporaryTopic(addr, null); } else { destination = new ActiveMQDestination(addr, TYPE.DESTINATION, null); } String unprefixedName = name; if (name.startsWith(PacketImpl.OLD_QUEUE_PREFIX.toString())) { unprefixedName = name.substring(PacketImpl.OLD_QUEUE_PREFIX.length()); } else if (name.startsWith(PacketImpl.OLD_TOPIC_PREFIX.toString())) { unprefixedName = name.substring(PacketImpl.OLD_TOPIC_PREFIX.length()); } else if (name.startsWith(PacketImpl.OLD_TEMP_QUEUE_PREFIX.toString())) { unprefixedName = name.substring(PacketImpl.OLD_TEMP_QUEUE_PREFIX.length()); } else if (name.startsWith(PacketImpl.OLD_TEMP_TOPIC_PREFIX.toString())) { unprefixedName = name.substring(PacketImpl.OLD_TEMP_TOPIC_PREFIX.length()); } destination.setName(unprefixedName); return destination; }
private ActiveMQTopic lookupTopic(final String topicName, final boolean isTemporary) throws ActiveMQException { String topicNameToUse = topicName; if (enable1xPrefixes) { topicNameToUse = (isTemporary ? PacketImpl.OLD_TEMP_TOPIC_PREFIX.toString() : PacketImpl.OLD_TOPIC_PREFIX.toString()) + topicName; } ActiveMQTopic topic; if (isTemporary) { topic = ActiveMQDestination.createTemporaryTopic(topicNameToUse); } else { topic = ActiveMQDestination.createTopic(topicNameToUse); } AddressQuery query = session.addressQuery(topic.getSimpleAddress()); if (!query.isExists() && !query.isAutoCreateAddresses()) { return null; } else { return topic; } }
private ActiveMQTopic lookupTopic(final String topicName, final boolean isTemporary) throws ActiveMQException { String topicNameToUse = topicName; if (enable1xPrefixes) { topicNameToUse = (isTemporary ? PacketImpl.OLD_TEMP_TOPIC_PREFIX.toString() : PacketImpl.OLD_TOPIC_PREFIX.toString()) + topicName; } ActiveMQTopic topic; if (isTemporary) { topic = ActiveMQDestination.createTemporaryTopic(topicNameToUse); } else { topic = ActiveMQDestination.createTopic(topicNameToUse); } AddressQuery query = session.addressQuery(topic.getSimpleAddress()); if (!query.isExists() && !query.isAutoCreateAddresses()) { return null; } else { return topic; } }
private ActiveMQTopic lookupTopic(final String topicName, final boolean isTemporary) throws ActiveMQException { String topicNameToUse = topicName; if (enable1xPrefixes) { topicNameToUse = (isTemporary ? PacketImpl.OLD_TEMP_TOPIC_PREFIX.toString() : PacketImpl.OLD_TOPIC_PREFIX.toString()) + topicName; } ActiveMQTopic topic; if (isTemporary) { topic = ActiveMQDestination.createTemporaryTopic(topicNameToUse); } else { topic = ActiveMQDestination.createTopic(topicNameToUse); } AddressQuery query = session.addressQuery(topic.getSimpleAddress()); if (!query.isExists() && !query.isAutoCreateAddresses()) { return null; } else { return topic; } }
private ActiveMQTopic lookupTopic(final String topicName, final boolean isTemporary) throws ActiveMQException { String topicNameToUse = topicName; if (enable1xPrefixes) { topicNameToUse = (isTemporary ? PacketImpl.OLD_TEMP_TOPIC_PREFIX.toString() : PacketImpl.OLD_TOPIC_PREFIX.toString()) + topicName; } ActiveMQTopic topic; if (isTemporary) { topic = ActiveMQDestination.createTemporaryTopic(topicNameToUse); } else { topic = ActiveMQDestination.createTopic(topicNameToUse); } AddressQuery query = session.addressQuery(topic.getSimpleAddress()); if (!query.isExists() && !query.isAutoCreateAddresses()) { return null; } else { return topic; } }
@Override public Destination getJMSDestination() throws JMSException { if (dest == null) { SimpleString address = message.getAddressSimpleString(); SimpleString changedAddress = checkPrefix(address); if (address == null) { dest = null; } else if (RoutingType.ANYCAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createQueue(address); } else if (RoutingType.MULTICAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createTopic(address); } else { dest = (ActiveMQDestination) ActiveMQDestination.fromPrefixedName(address.toString()); } if (changedAddress != null && dest != null) { ((ActiveMQDestination) dest).setName(changedAddress.toString()); } } return dest; }
@Override public Destination getJMSDestination() throws JMSException { if (dest == null) { SimpleString address = message.getAddressSimpleString(); SimpleString changedAddress = checkPrefix(address); if (address == null) { dest = null; } else if (RoutingType.ANYCAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createQueue(address); } else if (RoutingType.MULTICAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createTopic(address); } else { dest = (ActiveMQDestination) ActiveMQDestination.fromPrefixedName(address.toString()); } if (changedAddress != null && dest != null) { ((ActiveMQDestination) dest).setName(changedAddress.toString()); } } return dest; }
@Override public Destination getJMSDestination() throws JMSException { if (dest == null) { SimpleString address = message.getAddressSimpleString(); SimpleString name = address; if (address != null & enable1xPrefixes) { dest = ActiveMQDestination.fromPrefixedName(get1xPrefixedName(address.toString())); } else { if (address == null) { dest = null; } else if (RoutingType.ANYCAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createQueue(address); } else if (RoutingType.MULTICAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createTopic(address); } else { dest = (ActiveMQDestination) ActiveMQDestination.fromPrefixedName(address.toString()); } if (name != null) { ((ActiveMQDestination) dest).setName(name.toString()); } } } return dest; }
@Override public Destination getJMSDestination() throws JMSException { if (dest == null) { SimpleString address = message.getAddressSimpleString(); SimpleString name = address; if (address != null & enable1xPrefixes) { dest = ActiveMQDestination.fromPrefixedName(get1xPrefixedName(address.toString())); } else { if (address == null) { dest = null; } else if (RoutingType.ANYCAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createQueue(address); } else if (RoutingType.MULTICAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createTopic(address); } else { dest = (ActiveMQDestination) ActiveMQDestination.fromPrefixedName(address.toString()); } if (name != null) { ((ActiveMQDestination) dest).setName(name.toString()); } } } return dest; }