Last active
July 6, 2017 05:25
-
-
Save pjmuley/0bed483854a636f7e12fac11e9aa3bb8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"; | |
| // Post message to existing queue using API | |
| String messageId=UUID.randomUUID().toString(); | |
| String postURI=brokerURI+"/"+messageId; | |
| System.out.println(postURI); | |
| WebResource webResourcePost = client.resource(postURI); | |
| String inputPost="{ \"body\": \""+queueMessage+"\" }"; | |
| ClientResponse responsePost=webResourcePost.header("Authorization"," bearer" + access_token) | |
| .type("application/json") | |
| .accept("application/json") | |
| .put(ClientResponse.class, inputPost); | |
| String outputPost = responsePost.getEntity(String.class); | |
| System.out.println("Post Successful: \n"+outputPost); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment