Skip to content

Instantly share code, notes, and snippets.

@pjmuley
Last active July 6, 2017 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjmuley/042d4c4b10c39d959f8e3eae541af987 to your computer and use it in GitHub Desktop.
Save pjmuley/042d4c4b10c39d959f8e3eae541af987 to your computer and use it in GitHub Desktop.
String queueName="myQueue";
String queueMessage="This is my test message";
String brokerURI="https://mq-us-west-2.anypoint.mulesoft.com/api/v1/organizations/";
brokerURI = brokerURI + orgId +"/environments/"+ envId +"/destinations/"+ queueName+"/messages";
// Get message from existing queue using API
WebResource webResourceGet = client.resource(brokerURI);
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add("poolingTime","10000");
queryParams.add("batchSize","1");
queryParams.add("lockTtl","10000");
ClientResponse responseGet=webResourceGet.queryParams(queryParams)
.header("Authorization"," bearer" + access_token)
.type("application/json").accept("application/json").get(ClientResponse.class);
String outputGet = responseGet.getEntity(String.class);
System.out.println("Message Retrieved: \n" + outputGet);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment