web stats
Iterate HTTP Sender - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 09-15-2016, 06:24 AM
mikko mikko is offline
Mirth Newb
Join Date: May 2016
Posts: 10
mikko is on a distinguished road
Default Iterate HTTP Sender


Is it possible to iterate an HTTP sender destination?


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:

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.
Reply With Quote
Old 09-15-2016, 07:24 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road

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:

var array = ['A', 'B', 'C', 'D'];
for each (item in array) {
	router.routeMessageByChannelId('channel ID here', item);
Attached Files
File Type: xml Example - Split Batch on Comma.xml (14.6 KB, 10 views)
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.
Reply With Quote
Old 09-15-2016, 07:28 AM
mikko mikko is offline
Mirth Newb
Join Date: May 2016
Posts: 10
mikko is on a distinguished road

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

Thank you very much narupley.
Reply With Quote

http sender, iterate

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 04:20 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation