Announcement

Collapse
No announcement yet.

Iterate HTTP Sender

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Iterate HTTP Sender

    Hi,

    Is it possible to iterate an HTTP sender destination?

    Example:

    var list = ["A', "B", "C", "D"];

    In my destination, I have an HTTP sender (using Restful API). Can I trigger this destination based on the length of the array?

    Example API endpoint that will iterate on the array:
    https://api.company.com/records/list[i]

    Then each response on the API call will be assigned on another variable but will still be on one HL7 message.

    I was thinking involving another channel that will and saving the responses on a database the pulling those back on one message. Or is there a way to trigger HTTP sender via Javascript?



    Thank you.

  • #2
    If your inbound message is a sort of list like that (like CSV), you can use batching to automatically split that up into multiple messages. I've attached a channel (for 3.4.1) that shows how you can do that.

    If your inbound message isn't like that and you're actually building up that list in a transformer or something, you have a couple of options. First, split up your channel into two channels A and B, where A sends to B, and B is the one that actually has the HTTP Sender. Then you can have A build up a CSV-like list (or whatever format you want) and send it to B. Channel B could then do the same thing and have batch processing enabled so that it splits it up into multiple messages.

    The other way is still to split it up into two channels, but instead of using batch processing your upstream channel could just use a JavaScript Writer to dispatch to your downstream channel:

    Code:
    var array = ['A', 'B', 'C', 'D'];
    for each (item in array) {
    	router.routeMessageByChannelId('channel ID here', item);
    }
    Attached Files
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


    - How do I foo?
    - You just bar.

    Comment


    • #3
      I see, looks like I do need to make another channel on this one.

      Thank you very much narupley.

      Comment

      Working...
      X