Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1. //Importing
  2. //import com.rabbitmq.client.Channel;
  3. //import com.gitrekt.quora.queue.MessageQueueConnection;
  4. //import com.google.gson.JsonObject;
  5. //Available Types are :   new_follower,question_answered,question_starred,
  6. // answer_starred,new_message,new_post, discussion_invitation,question_invitation, poll_answered;\
  7. // In the case of discussion invitation you will add the property of
  8. //       msg.addProperty("discussionId", <theDisccusionId>);
  9. //        msg.addProperty("senderId", <theSenderId>);
  10. // In the case of Question invitation you will add the property of
  11. //       msg.addProperty("questionId", <theDisccusionId>);
  12. //        msg.addProperty("senderId", <theSenderId>);
  13.  
  14. try {
  15.       Channel channel = MessageQueueConnection.getInstance().createChannel();
  16.       JsonObject msg = new JsonObject();
  17.       msg.addProperty("senderId",<UserIDHere>);
  18.       msg.addProperty("type", <YourTypeIsHere>);
  19.  
  20.       channel.basicPublish("", "notification-v1-queue", null, msg.toString().getBytes());
  21.       channel.close();
  22.  
  23.     } catch (Exception exception) {
  24.       exception.printStackTrace();
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement