Exemplo n.º 1
0
  @Override
  protected void handleReceivedMessage(SoapEnvelope request) {
    if (request.body.notification != null) {
      BrokerMessage msg = request.body.notification.brokerMessage;

      if (msg != null) {
        SyncConsumer sc = SyncConsumerList.get(msg.destinationName);
        if (sc.count() > 0) {
          sc.offer(msg);
          sc.decrement();
        } else {
          _brokerClient.notifyListener(msg);
        }
      }
    } else if (request.body.status != null) {
      Status status = request.body.status;
      try {
        _brokerClient.feedStatusConsumer(status);
      } catch (Throwable t) {
        log.error(t.getMessage(), t);
      }
    } else if (request.body.fault != null) {
      SoapFault fault = request.body.fault;
      log.error(fault.toString());
      throw new RuntimeException(fault.faultReason.text);
    } else if (request.body.accepted != null) {
      // TODO: handle ACK
      // Accepted accepted = request.body.accepted;
    }
  }
Exemplo n.º 2
0
 @Override
 public void onConnectionOpen() {
   log.debug("Connection Opened");
   try {
     _brokerClient.sendSubscriptions();
   } catch (Throwable t) {
     log.error(t.getMessage(), t);
   }
 }
Exemplo n.º 3
0
  public BrokerProtocolHandler(BrokerClient brokerClient) throws UnknownHostException, IOException {
    _brokerClient = brokerClient;

    _connector = new NetworkConnector(brokerClient.getHost(), brokerClient.getPort());
  }