@Override
    public void run() {
      TCPEventPublisher tcpEventPublisher = null;
      try {
        tcpEventPublisher = new TCPEventPublisher("localhost:7612", isSynchronous, null);
        tcpEventPublisher.addStreamDefinition(streamDefinition);
        Thread.sleep(1000);
        log.info("Starting event client to send events to localhost:7612");

        for (int i = 0; i < eventsToSend; i++) {
          tcpEventPublisher.sendEvent(
              streamDefinition.getId(), System.currentTimeMillis(), dataProvider.getEvent(), true);
          if (delay > 0) {
            Thread.sleep(delay);
          }
        }
      } catch (IOException e) {
        e.printStackTrace();
      } catch (InterruptedException e) {
        e.printStackTrace();
      } finally {
        if (tcpEventPublisher != null) {
          tcpEventPublisher.shutdown();
        }
      }
    }
 public void addStreamDefinition(StreamDefinition streamDefinition) {
   String streamId = streamDefinition.getId();
   this.streamRuntimeInfoMap.put(
       streamId, EventServerUtils.createStreamRuntimeInfo(streamDefinition));
 }