@Override public int hashCode() { return super.getAddress().hashCode(); }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof ActiveMQTopic)) { return false; } ActiveMQTopic that = (ActiveMQTopic) o; return super.getAddress().equals(that.getAddress()); }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof ActiveMQTemporaryTopic)) { return false; } ActiveMQTemporaryTopic that = (ActiveMQTemporaryTopic) o; return super.getAddress().equals(that.getAddress()); }
@Override public int hashCode() { return super.getAddress().hashCode(); }
@Override public int hashCode() { return super.getAddress().hashCode(); }
@Override public int hashCode() { return super.getAddress().hashCode(); }
@Override public int hashCode() { return super.getAddress().hashCode(); }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof ActiveMQTopic)) { return false; } ActiveMQTopic that = (ActiveMQTopic) o; return super.getAddress().equals(that.getAddress()); }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof ActiveMQTemporaryTopic)) { return false; } ActiveMQTemporaryTopic that = (ActiveMQTemporaryTopic) o; return super.getAddress().equals(that.getAddress()); }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof ActiveMQTemporaryTopic)) { return false; } ActiveMQTemporaryTopic that = (ActiveMQTemporaryTopic) o; return super.getAddress().equals(that.getAddress()); }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof ActiveMQTopic)) { return false; } ActiveMQTopic that = (ActiveMQTopic) o; return super.getAddress().equals(that.getAddress()); }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof ActiveMQTemporaryTopic)) { return false; } ActiveMQTemporaryTopic that = (ActiveMQTemporaryTopic) o; return super.getAddress().equals(that.getAddress()); }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof ActiveMQTemporaryTopic)) { return false; } ActiveMQTemporaryTopic that = (ActiveMQTemporaryTopic) o; return super.getAddress().equals(that.getAddress()); }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof ActiveMQTopic)) { return false; } ActiveMQTopic that = (ActiveMQTopic) o; return super.getAddress().equals(that.getAddress()); }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof ActiveMQTopic)) { return false; } ActiveMQTopic that = (ActiveMQTopic) o; return super.getAddress().equals(that.getAddress()); }
@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()); } }
@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; } }
@Test(timeout = 10000) public void testActiveMQTopicFromPropertiesJNDI() throws Exception { Properties properties = new Properties(); properties.setProperty(TYPE, ActiveMQTopic.class.getName()); properties.setProperty(FACTORY, JNDIReferenceFactory.class.getName()); String address = "foo.bar.topic"; properties.setProperty("address", address); Reference reference = from(properties); ActiveMQTopic object = getObject(reference, ActiveMQTopic.class); assertEquals(address, object.getAddress()); }
Bindings bindings = server.getPostOffice().getBindingsForAddress(new SimpleString(topic.getAddress())); Map<SimpleString, List<Binding>> routingNames = ((BindingsImpl) bindings).getRoutingNameBindingMap(); for (SimpleString key : routingNames.keySet()) { if (!key.toString().equals(topic.getAddress())) { foundStrayRoutingBinding = true; assertEquals(0, ((LocalQueueBinding) routingNames.get(key).get(0)).getQueue().getMessageCount());