move messages from error queue to parent queue in Redhat Active MQ

88 views
Skip to first unread message

Pradeep Drall

unread,
Aug 20, 2018, 12:34:20 PM8/20/18
to Ansible Project
Hi, 

I would like to move messages from error queue to parent queue in Redhat Active MQ.  

I want to automate Jolokia REST Url moveMessages(int,java.lang.String,java.lang.String,boolean) concept through ansible uri module but getting below mentioned error. I use POST and PUT method but getting error. 

Please do let me know how to execute this url through ansible script. 

// uri.yml 
---
- hosts: all
  gather_facts: True

  tasks:      
     - name: move messages from error queue to main queue 
       uri:
        method: POST
        HEADER_Content-Type: "application/json"
        user: "P"
        password: "P"
        force_basic_auth: yes
        status_code: 204
       register: webpage
       
     - debug:
        var: webpage.stdout_lines
       ignore_errors: yes
  
// Error
   
   SSH password: 
PLAY [all] *********************************************************************12:18:19
TASK [Gathering Facts] *********************************************************12:18:19
ok: [abc.net]
TASK [uri for dead letter queue] ***********************************************12:18:24
[DEPRECATION WARNING]: Supplying headers via HEADER_* is deprecated. 
********lease use `headers` to supply headers for the request. This feature 
will be removed in version 2.9. Deprecation warnings can be disabled by setting
 deprecation_warnings=False in ansible.cfg.
fatal: [abc.net]: FAILED! => {"access_control_allow_origin": "*", "cache_control": "no-cache", "changed": false, "connection": "close", "content": "{\"error_type\":\"java.lang.IllegalArgumentException\",\"error\":\"java.lang.IllegalArgumentException : Invalid JSON request java.io.InputStreamReader@16b8f4da\",\"status\":400}", "content_type": "text/plain;charset=utf-8", "cookies": {}, "date": "Mon, 20 Aug 2018 16:18:25 GMT", "expires": "Mon, 20 Aug 2018 15:18:25 GMT", "json": {"error": "java.lang.IllegalArgumentException : Invalid JSON request java.io.InputStreamReader@16b8f4da", "error_type": "java.lang.IllegalArgumentException", "status": 400}, "msg": "Status code was 200 and not [204]: OK (unknown bytes)", "pragma": "no-cache", "redirected": false, "server": "Jetty(9.4.z-SNA********SHOT)", "status": 200, "url": "http://abc.net:9161/console/jolokia/exec/org.apache.activemq.artemis:broker=%22BROKER1-MASTER%22,component=addresses,address=%22business_select_enrollment
PLAY RECAP *********************************************************************12:18:25
abc.net  : ok=1    changed=0    unreachable=0    failed=1   

Dick Visser

unread,
Aug 20, 2018, 4:36:02 PM8/20/18
to ansible...@googlegroups.com
It says " Invalid JSON request".
Which seems to make sense, as you have set the HTTP method to POST,
but at the same time you have manually constructed the entire (GET)
request, and also didn't configure any 'body' parameter.
I'd start with supplying a properly formatted 'body' parameter first.
Although I'm not sure what that looks like in your case, because the
request URL seems to be using a comma (as opposed to an ampersand) to
separate the query parameters? This may well be my inexperience with
activemq however.

You might want to read up on the uri module docs, more specifically
https://docs.ansible.com/ansible/latest/modules/uri_module.html#examples.
You'll see that several of the option you use (such as HEADER_*) are
deprecated by now.


Dick
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/5af16792-8cc3-4821-87a0-d2800ee8ec7c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT
T: +31205304488
PGP key fingerprint: F575 58C6 62C6 FD5B A9CD 217C 2667 13D4 E6EF 488D
GÉANT Vereniging (Association) is registered with the Chamber of
Commerce in Amsterdam with registration number 40535155 and operates
in the UK as a branch of GÉANT Vereniging. Registered office:
Hoekenrode 3, 1102 BR Amsterdam, The Netherlands. UK branch address:
City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK.
Reply all
Reply to author
Forward
0 new messages