Advertisement
Guest User

Untitled

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