@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())); }
@Override public void onMessage(ClientMessage msg) { T messageData = readBody(msg, messageType); removeFromQueue(msg); sink.consume(message(msg, messageData)); }
/** * Creates a new instance. * * @param queue provides access to the queue from which to fetch messages. * @param consumer consumes message data fetched from the queue. * @param messageType the class of the message data the consumer accepts; needed for * deserialization. * @throws HornetQException if an error occurs while setting up HornetQ to receive messages on the * specified queue. * @throws NullPointerException if any argument is {@code null}. */ public DequeueTask(QueueConnector queue, ChannelSink<T> consumer, Class<T> messageType) throws HornetQException { this(queue, MessageSink.forwardDataTo(consumer), messageType); }