Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. //package org.unibl.etf.mq;
  2.  
  3. import java.util.Scanner;
  4.  
  5. import javax.ws.rs.client.Client;
  6. import javax.ws.rs.client.ClientBuilder;
  7. import javax.ws.rs.core.Response;
  8.  
  9. /*import com.rabbitmq.client.Channel;
  10. import com.rabbitmq.client.Connection;
  11. import com.rabbitmq.client.ConnectionFactory;
  12. */
  13. public class Sender {
  14.  
  15. private final static String QUEUE_NAME = "test";
  16.  
  17. public static void main(String[] argv) throws Exception {
  18. /* ConnectionFactory factory = new ConnectionFactory();
  19. factory.setHost("localhost");
  20. Connection connection = factory.newConnection();
  21. Channel channel = connection.createChannel();
  22.  
  23. channel.queueDeclare(QUEUE_NAME, false, false, false, null);
  24.  
  25. Scanner in = new Scanner(System.in);
  26. System.out.print("Unesi prvu poruku: ");
  27. String message;
  28. */
  29. Client client = ClientBuilder.newClient();
  30. Response response = client.target("http://commerce.com/customers/123")
  31. .accept("application/json")
  32. .get();
  33.  
  34. /* while(!(message=in.nextLine()).equals("QUIT")){
  35. channel.basicPublish("", QUEUE_NAME, null, message.getBytes("UTF-8"));
  36. System.out.println("Sending: '" + message + "'");
  37. System.out.print("Unesi sljedeću poruku: ");
  38. }
  39. in.close();
  40. channel.close();
  41. connection.close();*/
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement