/**
   * Start up the auditor service.
   *
   * @param args Named Event Sets to Capture to the Log.
   */
  public static void main(String[] args) {

    AmqpConfiguration config =
        AmqpConfiguration.getDefault(
            "AuditorService", new AmqpConnectionParameters("amqp://*****:*****@localhost:5672/"));

    EventManager em = new AmqpEventManager(config);

    em.start();

    new AuditorService(em, args);
  }
Пример #2
0
  public void initialize(String[] args) {

    String connectionString = "amqp://*****:*****@localhost:5672/";

    if (args.length > 0 && args[0].startsWith("amqp://")) {

      connectionString = args[0];

      this.cmdlineArgs = pruneFirst(args);
    } else {

      this.cmdlineArgs = args;
    }

    // Manually configure the EventManager
    AmqpConfiguration config =
        AmqpConfiguration.getDefault("tweetstream", new AmqpConnectionParameters(connectionString));

    // Initialize the EventManager
    this.eventManager = new AmqpEventManager(config);

    // Start the EventManager
    this.eventManager.start();

    // Create a Twitter Stream instance (3rd Party API)
    this.twitterStream = new TwitterStreamFactory().getInstance();

    // Create a new instance of our Twitter listener that will
    // publish incoming Tweets onto the bus.
    TweetPublisher publishOnBusListener = new TweetPublisher(this.eventManager);

    // Register our listener with the Twitter Stream API
    twitterStream.addListener(publishOnBusListener);

    // Start publishing the TwitterStreamMode
    new TwitterStreamModePublisher(this.getTwitterStreamMode(), this.eventManager).start();

    wireUpBus(this.eventManager);

    startUpTwitter(twitterStream);
  }