Exemplo n.º 1
0
  @Override
  public void consume(ChannelMessage<ClientMessage, T> queued) {
    Optional<CountedSchedule> current =
        getScheduleCount(queued.metadata().get()).map(count -> new CountedSchedule(now(), count));

    consumer.consume(message(current, queued.data()));
  }
Exemplo n.º 2
0
  @Override
  public void send(ChannelMessage<CountedSchedule, T> msg) throws Exception {
    requireNonNull(msg, "msg");

    CountedSchedule metadata = msg.metadata().orElse(CountedSchedule.first());
    channel.send(
        message(
            durableMessage()
                .andThen(setScheduledDeliveryTime(metadata.when()))
                .andThen(setScheduleCount(metadata.count())),
            msg.data()));
  }