@Override public TopicMetadata getTopic(TopicId topicId) throws TopicNotFoundException, IOException { return getMessagingService().getTopic(topicId); }
@Override public TopicMetadata getTopic(TopicId topicId) throws TopicNotFoundException, IOException { return getMessagingService().getTopic(topicId); }
@GET @Path("/topics/{topic}") public void getTopic(HttpRequest request, HttpResponder responder, @PathParam("namespace") String namespace, @PathParam("topic") String topic) throws Exception { TopicId topicId = new NamespaceId(namespace).topic(topic); TopicMetadata metadata = messagingService.getTopic(topicId); responder.sendJson(HttpResponseStatus.OK, GSON.toJson(metadata.getProperties(), TOPIC_PROPERTY_TYPE)); }
@GET @Path("/topics/{topic}") public void getTopic(HttpRequest request, HttpResponder responder, @PathParam("namespace") String namespace, @PathParam("topic") String topic) throws Exception { TopicId topicId = new NamespaceId(namespace).topic(topic); TopicMetadata metadata = messagingService.getTopic(topicId); responder.sendJson(HttpResponseStatus.OK, GSON.toJson(metadata.getProperties(), TOPIC_PROPERTY_TYPE)); }
@Override public Map<String, String> getTopicProperties(String topic) throws TopicNotFoundException, IOException { return messagingService.getTopic(namespace.topic(topic)).getProperties(); }
@Override public Map<String, String> getTopicProperties(String topic) throws TopicNotFoundException, IOException { return messagingService.getTopic(namespace.topic(topic)).getProperties(); }
@Test public void testGeMetadata() throws Exception { TopicId topicId = new NamespaceId("ns2").topic("d"); TopicMetadata metadata = new TopicMetadata(topicId, "ttl", "100"); for (int i = 1; i <= 5; i++) { client.createTopic(metadata); TopicMetadata topicMetadata = client.getTopic(topicId); Assert.assertEquals(100, topicMetadata.getTTL()); Assert.assertEquals(i, topicMetadata.getGeneration()); client.deleteTopic(topicId); } }