예제 #1
0
  @Override
  public void handle(SockJSSocket sockJSSocket) {
    final String sessionId = sockJSSocket.webSession().id();
    final MessageConsumer<String> sessionConsumer = consumers.get(sessionId);

    if (sessionConsumer == null) {
      final MessageConsumer<String> consumer =
          eventStore.consumer(
              UpdateOrdrEvent.class,
              message -> {
                final String id = sockJSSocket.webSession().get("id").toString();
                JsonObject dashboardJson = new JsonObject(message.body());
                if (dashboardJson.getString("id").equals(id)) {
                  sockJSSocket.write(Buffer.buffer(message.body()));
                }
              });
      log.info("bound WS handler to sessionId {}", sessionId);
      consumers.put(sessionId, consumer);
      log.info("registered consumers {}", consumers.size());
    }

    sockJSSocket.endHandler(
        aVoid -> {
          final MessageConsumer<String> consumer = consumers.get(sessionId);
          consumer.unregister();
          consumers.remove(sessionId);
          log.info("unregistered consumer for sessionId {}", sessionId);
        });
  }
 public HttpResponseHandler(MailgunSendRequest sendRequest) {
   this.sendRequest = sendRequest;
   this.totalBuffer = Buffer.buffer();
 }
 public MultiPartUtility() {
   this.buffer = Buffer.buffer();
 }