Ejemplo n.º 1
0
  @Override
  public void activateOptions() {
    super.activateOptions();

    if (manager == null) {
      manager = MessageManager.getInstance();
      Properties senderProperties = new Properties();
      senderProperties.put(MessageManager.collectorsProperty, collectors);
      senderProperties.put(MessageManager.senderTimeOutProperty, "" + senderTimeOut);
      senderProperties.put(MessageManager.coreThreadProperty, "" + coreThreadCount);
      if (senderType != null) {
        senderProperties.put(MessageManager.senderTypeProperty, senderType);
      }
      manager.start(senderProperties);
    }

    if (initDone == false) {
      synchronized (lock) {
        if (initDone == false) {
          initDone = true;
        } else {
          return;
        }
      }

      Properties consumerProperties = new Properties();
      consumerProperties.put(MessageManager.sourceProperty, source);
      consumerProperties.put(MessageManager.streamNameProperty, streamName);
      consumerProperties.put(MessageManager.applicationProperty, application);
      consumerProperties.put(MessageManager.dataTypeProperty, dataType);

      tags =
          tags
              + " version=\""
              + HonuLog4jStreamingAppender.class.getPackage().getImplementationVersion()
              + "\" ";

      consumerProperties.put(MessageManager.tagsProperty, tags);
      consumerProperties.put(MessageManager.thresholdProperty, "" + messageQueueThreshold);
      consumerProperties.put(MessageManager.samplingPeriodProperty, "" + samplingPeriod);
      consumerProperties.put(
          MessageManager.maxMessageCountPerChunkProperty, "" + maxMessageCountPerChunk);
      consumer = manager.createConsumer(consumerProperties);
    }
  }
Ejemplo n.º 2
0
 @Override
 public void close() {
   MessageManager.getInstance().shutdown();
 }