public static Pipeline build() { Pipeline p = Pipeline.create(); // Palladium and Platinum only p.drawFrom(Sources.<String, Object>mapJournal( Constants.IMAP_NAME_PRECIOUS, JournalInitialPosition.START_FROM_OLDEST) ).map(e -> e.getKey() + "==" + e.getValue()) .filter(str -> str.toLowerCase().startsWith("p")) .drainTo(Sinks.logger()) ; return p; }
private static Pipeline buildPipeline() { Pipeline p = Pipeline.create(); p.drawFrom(Sources.jmsTopic(() -> new ActiveMQConnectionFactory(ActiveMQBroker.BROKER_URL), INPUT_TOPIC)) .filter(message -> message.getJMSPriority() > 3) .map(message -> (TextMessage) message) // print the message text to the log .peek(TextMessage::getText) .drainTo(Sinks.<TextMessage>jmsTopicBuilder(() -> new ActiveMQConnectionFactory(ActiveMQBroker.BROKER_URL)) .destinationName(OUTPUT_TOPIC) .messageFn((session, message) -> { TextMessage textMessage = session.createTextMessage(message.getText()); textMessage.setBooleanProperty("isActive", true); textMessage.setJMSPriority(8); return textMessage; }) .build()); return p; }
private static Pipeline buildPipeline() { Pipeline p = Pipeline.create(); p.drawFrom(Sources.jmsQueue(() -> new ActiveMQConnectionFactory(ActiveMQBroker.BROKER_URL), INPUT_QUEUE)) .filter(message -> message.getJMSPriority() > 3) .map(message -> (TextMessage) message) // print the message text to the log .peek(TextMessage::getText) .drainTo(Sinks.<TextMessage>jmsQueueBuilder(() -> new ActiveMQConnectionFactory(ActiveMQBroker.BROKER_URL)) .destinationName(OUTPUT_QUEUE) .messageFn((session, message) -> { // create new text message with the same text and few additional properties TextMessage textMessage = session.createTextMessage(message.getText()); textMessage.setBooleanProperty("isActive", true); textMessage.setJMSPriority(8); return textMessage; } ) .build()); return p; }
JournalInitialPosition.START_FROM_OLDEST)) .filter(eventJournalMapEvent -> eventJournalMapEvent.getType().equals(EntryEventType.UPDATED)) .filter(tuple2 -> ((Tuple2<Map<String, Integer>, Map<String, Integer>>) tuple2).f0().size() < ((Tuple2<Map<String, Integer>, Map<String, Integer>>) tuple2).f1().size()