Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. public static void main(String[] args) {
  2.  
  3. // set up pipeline options
  4. Options options = PipelineOptionsFactory.fromArgs(args).withValidation().as(Options.class);
  5. options.setStreaming(true);
  6. Pipeline pipeline = Pipeline.create(options);
  7.  
  8. Jedis jedis = new Jedis("localhost");
  9.  
  10. JedisPubSub pubsub = new JedisPubSub() {
  11.  
  12. @Override
  13. public void onMessage(String channel, String message) {
  14. super.onMessage(channel, message);
  15.  
  16. JSONObject jsonObject = new JSONObject(message);
  17. }
  18.  
  19. };
  20.  
  21. jedis.subscribe(pubsub, "data-stream");
  22.  
  23. pipeline.apply(
  24. "ReadFromPubSub", //This is where I need to pass a method that returns the message from the pubsub
  25. )
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement