public void receive(Message message) throws MessageListenerException {
    String destinationName =
        GetterUtil.getString(message.getString(SchedulerEngine.DESTINATION_NAME));

    if (destinationName.equals(DestinationNames.SCHEDULER_DISPATCH)) {
      String receiverKey = GetterUtil.getString(message.getString(SchedulerEngine.RECEIVER_KEY));

      if (!receiverKey.equals(_key)) {
        return;
      }
    }

    try {
      _messageListener.receive(message);
    } catch (Exception e) {
      handleException(message, e);

      if (e instanceof MessageListenerException) {
        throw (MessageListenerException) e;
      } else {
        throw new MessageListenerException(e);
      }
    } finally {
      if (message.getBoolean(SchedulerEngine.DISABLE)
          && destinationName.equals(DestinationNames.SCHEDULER_DISPATCH)) {

        MessageBusUtil.unregisterMessageListener(destinationName, this);
      }
    }
  }
Ejemplo n.º 2
0
 public static boolean isForwardMessage(Message message) {
   return message.getBoolean(ClusterLink.CLUSTER_FORWARD_MESSAGE);
 }