Skip to main content

Integration of RabbitMQ (message broker software)

  • October 15, 2019
  • 3 replies
  • 1 view

Michael Rösch
Forum|alt.badge.img+2

Hello together,

we would like to integrate RabbitMQ into our Uniface programs in order to send/receive messages to/from non-uniface applications. Does anybody of you guys has any experience with that and wants to share it with me?

Thank you in advance,

Michael.

3 replies

dino seelig
Forum|alt.badge.img
  • Participating Frequently
  • October 15, 2019

Hello together,

we would like to integrate RabbitMQ into our Uniface programs in order to send/receive messages to/from non-uniface applications. Does anybody of you guys has any experience with that and wants to share it with me?

Thank you in advance,

Michael.

use http to communate with rabbitmq.


; Optional register the winhttp.dll in your registry

; regsvr32 c:\\windows\\system32\\winhttp.dll


; Generate signature WINHTTPREQUEST, ProgId WinHttp.WinHttpRequest5.1

; AND

; change operation GET_RESPONSEBODY,

; paramter result_,

; data Type basic Raw,

; interface VT_ARRAY | VTUI1 (array of bytes)

public operation zHttpRequest

params
string pUri : IN
string pBody : IN
string pResponse : OUT
endparams

variables
handle vWinHttpReq
numeric vStatus
endvariables

filedump "pUri = %%pUri%%%%%^", "%%$logical("path-web-outputfile")%%%httprequest.txt"
filedump/append "pBody = %%pBody%%%%%^", "%%$logical("path-web-outputfile")%%%httprequest.txt"

newInstance "winHttpRequest", vWinHttpReq
if ($procError < 0)
vStatus = $instanceHandle()->zPError("Z0052", $procErrorContext, $dataErrorContext, $dbError, $dbErrorText, "newinstance winHttpRequest", "")
return(-1)
endif

vStatus = vWinHttpReq->Open("POST", pUri, 0) ; 0 Synchron
if ($procError < 0)
vStatus = $instanceHandle()->zPError("Z0052", $procErrorContext, $dataErrorContext, $dbError, $dbErrorText, "winHttpRequest.open", "")
return(-1)
endif

vStatus = vWinHttpReq->SetRequestHeader("content-type", "text/xml");
if ($procError < 0)
vStatus = $instanceHandle()->zPError("Z0052", $procErrorContext, $dataErrorContext, $dbError, $dbErrorText, "winHttpRequest.SetRequestHeader", "")
return(-1)
endif

vStatus = vWinHttpReq->SetTimeOuts(0,120000,120000,120000) ; Resolve, Connection, Send, Recieve in milliseconds (60.000 = 60 seconds)
if ($procError < 0)
vStatus = $instanceHandle()->zPError("Z0052", $procErrorContext, $dataErrorContext, $dbError, $dbErrorText, "winHttpRequest.SetTimeOuts", "")
return(-1)
endif

vStatus = vWinHttpReq->Send(pBody)
if ($procError < 0)
vStatus = $instanceHandle()->zPError("Z0052", $procErrorContext, $dataErrorContext, $dbError, $dbErrorText, "winHttpRequest.Send uri=%%pUri%%%", "")
return(-1)
endif

vStatus = vWinHttpReq->get_ResponseText(pResponse)
if ($procError < 0)
vStatus = $instanceHandle()->zPError("Z0052", $procErrorContext, $dataErrorContext, $dbError, $dbErrorText, "winHttpRequest.get_ResponseText", "")
return(-1)
endif

return(1)

end ; operation zHttpRequest















Michael Rösch
Forum|alt.badge.img+2
  • Author
  • Participating Frequently
  • October 15, 2019

Hello together,

we would like to integrate RabbitMQ into our Uniface programs in order to send/receive messages to/from non-uniface applications. Does anybody of you guys has any experience with that and wants to share it with me?

Thank you in advance,

Michael.

Hi Dino,

thank you very much for your quick response.

I tried it already with the http api. And yes, it works.

A view in the api documentation show me statements like this one:: "Please note that the get path in the HTTP API is intended for diagnostics etc - it does not implement reliable delivery and so should be treated as a sysadmin's tool rather than a general API for messaging."
or this: "Please note that the HTTP API is not ideal for high performance publishing; the need to create a new TCP connection for each message published can limit message throughput compared to AMQP or other protocols using long-lived connections."

I am a bit unsure...

Do you see a possibility to communicate by another way with rabbitMQ?

Or don't you find there could be a problem?

Best regards,

Michael.



dino seelig
Forum|alt.badge.img
  • Participating Frequently
  • October 15, 2019

Hello together,

we would like to integrate RabbitMQ into our Uniface programs in order to send/receive messages to/from non-uniface applications. Does anybody of you guys has any experience with that and wants to share it with me?

Thank you in advance,

Michael.

Hi Michael,

I use this approach often, also in a my web application handling 500.000 transactions a year. a) web is async, b) underlying api is Microsoft (reliable enough). Success with the implementation.  Another way could be using asyn interrupt trigger sending event from one product to another. kind of broadcasting. i used that for connecting a phone application (using predictive call's that kind of stuff, with uniface). but when it supports http...i never will choose that approach.

With kind regards,

Dino Seelig

TCCO.NL BV