Permalink
Browse files

Add subscribers button per topic

  • Loading branch information...
chamerling committed Nov 19, 2012
1 parent 553cd17 commit 4cf5109c6a891880a64cc2dd4ba85ae0fa2a72c9
Showing with 32 additions and 1 deletion.
  1. +30 −0 app/controllers/SubscriptionsController.java
  2. +1 −1 app/views/TopicsController/topics.html
  3. +1 −0 conf/routes
@@ -377,4 +377,34 @@ public static void search(String consumer, String provider,
flash.error("Can not find any subscription");
subscriptions();
}
+
+ public static void getSubscribersForTopic(String topicname, String topicns, String topicprefix) {
+ try {
+ SubscriptionRegistry client = Locator
+ .getSubscriptionRegistry(getNode());
+
+ Subscription filter = new Subscription();
+
+ Topic topic = new Topic();
+ if (topicname != null && topicname.length() > 0) {
+ topic.setName(topicname);
+ filter.setTopic(topic);
+ }
+
+ long start = System.currentTimeMillis();
+ List<Subscription> subscriptions = client.getSubscriptions(filter);
+ long stop = System.currentTimeMillis() - start;
+ if (subscriptions == null) {
+ flash.error("No result");
+ } else {
+ flash.success("Subscription search results : " + subscriptions.size() + " (took " + stop + " ms)");
+ }
+ render("SubscriptionsController/subscriptions.html", subscriptions);
+
+ } catch (Exception e) {
+ handleException("Problem while getting client", e);
+ }
+ flash.error("Can not find any subscription");
+ subscriptions();
+ }
}
@@ -28,7 +28,7 @@ <h1>Topics</h1>
<td><b>${t.name}</b></td>
<td><a href="${t.ns}" target="_blank">${t.ns}</a></td>
<td>${t.prefix}</td>
- <td><a href="@{TopicsController.topic(t.name, t.ns, t.prefix)}" class="btn">Details</a>&nbsp;<a href="@{SubscriptionsController.createFrom(t.name, t.ns, t.prefix)}" class="btn">Subscribe</a></td>
+ <td><a href="@{TopicsController.topic(t.name, t.ns, t.prefix)}" class="btn">Details</a>&nbsp;<a href="@{SubscriptionsController.createFrom(t.name, t.ns, t.prefix)}" class="btn">Subscribe</a>&nbsp;<a href="@{SubscriptionsController.getSubscribersForTopic(t.name, t.ns, t.prefix)}" class="btn">Subscribers</a></td>
</tr>
#{/list}
</tbody>
View
@@ -42,6 +42,7 @@ GET /subscription/clear SubscriptionsController.removeAl
GET /subscription/manage SubscriptionsController.manage
POST /subscription/search SubscriptionsController.search
GET /subscription/unsubscribe/{uuid} SubscriptionsController.unsubscribeFromUUID
+GET /subscription/searchfortopic SubscriptionsController.getSubscribersForTopic
GET /bootsubscription/new SubscriptionsController.createBootSubscriptions
GET /bootsubscription/delete SubscriptionsController.deleteBoot

1 comment on commit 4cf5109

Owner

chamerling commented on 4cf5109 Nov 19, 2012

@play-project/developers added Subscribers button to search subscribers per topic, can be useful...

Please sign in to comment.