Sending Two Resposes to openHIM

9 views
Skip to first unread message

Ally Shaban

unread,
Jul 18, 2017, 8:43:04 AM7/18/17
to OpenHIM-Implementers
Hi All,
I have a process that is called by rapidpro and it is taking long time to finish. The process does not need to send any response data to rapidpro but rapidpro needs to be sent with a 200 code. The issue is that,i want to log to openhim everything that this process is doing,but i cant log to openhim anything after i send back the 200 code to rapidpro. Is there a way i can fix this?

Ally.

Martin Brocker

unread,
Jul 18, 2017, 10:12:38 AM7/18/17
to Ally Shaban, OpenHIM-Implementers
Hi Ally

Based on your description it looks like you want the mediator to immediately respond to the OpenHIM with a 200 status code, so that the rapidpro functionality can be executed, but it is taking along time due to other functions being executed. What you can do is to respond to the OpenHIM as soon as the endpoint in the mediator is reached, which will trigger the rapidpro functionality, and then when the other requests are completed, we can added them to the OpenHIM transaction

The OpenHIM allows for a transaction to be updated after it has been completed, but you will need to supply it with the correct header details and transactionID, 
Have a look at the tests that will explain this in more detail: https://github.com/jembi/openhim-core-js/blob/master/test/integration/transactionsAPITests.coffee#L402-L479
you can also see a it being used in our file queue mediator: https://github.com/jembi/openhim-mediator-file-queue/blob/38f595face5fd6a83199b1b22da762c35b7e1c62/lib/worker.js#L111-L154

Warm regards,
Martin


--
You received this message because you are subscribed to the Google Groups "OpenHIM-Implementers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhim-implemen...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ally Shaban

unread,
Jul 18, 2017, 10:28:45 AM7/18/17
to Martin Brocker, OpenHIM-Implementers
Great,this is what i was looking Martin.

Thank you,

Ally.

To unsubscribe from this group and stop receiving emails from it, send an email to openhim-implementers+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "OpenHIM-Implementers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openhim-implementers/-7x4Li90jo4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openhim-implementers+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages