public void process( IncomingMessageEnvelope envelope, MessageCollector collector, TaskCoordinator coordinator) { System.out.println( "Adding " + envelope.getMessage() + " => " + envelope.getMessage() + " to the store."); store.put((String) envelope.getMessage(), (String) envelope.getMessage()); coordinator.commit(RequestScope.ALL_TASKS_IN_CONTAINER); }
public void init(Config config, TaskContext context) { this.store = (KeyValueStore<String, String>) context.getStore("mystore"); System.out.println("Contents of store: "); KeyValueIterator<String, String> iter = store.all(); while (iter.hasNext()) { Entry<String, String> entry = iter.next(); System.out.println(entry.getKey() + " => " + entry.getValue()); } iter.close(); }