コード例 #1
0
  @DELETE
  @Path("broker")
  public void deleteConfiguration() {
    broker.setConfiguration(new Configuration());

    // Broadcast new stream list
    OutboundEvent.Builder eventBuilder = new OutboundEvent.Builder();
    OutboundEvent event =
        eventBuilder
            .name("broker")
            .mediaType(MediaType.APPLICATION_JSON_TYPE)
            .data(Configuration.class, broker.getConfiguration())
            .build();
    broadcaster.broadcast(event);
  }
コード例 #2
0
  @DELETE
  @Path("broker/{routing-id}")
  public void deleteRouting(@PathParam("routing-id") String name) {
    broker.removeRouting("^" + name + "$");

    // Broadcast new stream list
    OutboundEvent.Builder eventBuilder = new OutboundEvent.Builder();
    OutboundEvent event =
        eventBuilder
            .name("broker")
            .mediaType(MediaType.APPLICATION_JSON_TYPE)
            .data(Configuration.class, broker.getConfiguration())
            .build();
    broadcaster.broadcast(event);
  }
コード例 #3
0
  @PUT
  @Path("broker/{routing-id}")
  public void addRouting(@PathParam("routing-id") String name, Routing routing) {
    routing.setName(name); // Ensure that name is the same as the one specified on the URL
    broker.addRouting(routing);

    // Broadcast new stream list
    OutboundEvent.Builder eventBuilder = new OutboundEvent.Builder();
    OutboundEvent event =
        eventBuilder
            .name("broker")
            .mediaType(MediaType.APPLICATION_JSON_TYPE)
            .data(Configuration.class, broker.getConfiguration())
            .build();
    broadcaster.broadcast(event);
  }
コード例 #4
0
  @PUT
  @Path("broker")
  @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
  public void setConfiguration(Configuration configuration) {
    broker.setConfiguration(configuration);

    // Broadcast new stream list
    OutboundEvent.Builder eventBuilder = new OutboundEvent.Builder();
    OutboundEvent event =
        eventBuilder
            .name("broker")
            .mediaType(MediaType.APPLICATION_JSON_TYPE)
            .data(Configuration.class, broker.getConfiguration())
            .build();
    broadcaster.broadcast(event);
  }
コード例 #5
0
 @GET
 @Path("broker/{routing-id}")
 public Routing getRouting(@PathParam("routing-id") String name) {
   for (Routing r : broker.getConfiguration().getRouting()) {
     if (r.getName().equals(name)) {
       return r;
     }
   }
   return null;
 }
コード例 #6
0
 @GET
 @Path("broker")
 @Produces(MediaType.APPLICATION_JSON)
 public Configuration getConfiguration() {
   return broker.getConfiguration();
 }