Testing guaranteed queue based message delivery over flow in C

I have a C++ application using solace C API to read guaranteed message over a flow, with queue based message delivery. Currently I connect to broker to test my application, but I would like to add some local tests, that I can run on my machine to test the complete flow at my end.

I need to have a message publisher, which can publish messages on queue like that. I found one HelloWorldQueuePub.c example on C documentation page to be what I need but I am unable to get them to work.

I am assuming these two are supposed to work together, Intro/HelloWorldQueuePub.c
Intro/HelloWorldQueueSub.c. But when I try to run them I am seeing some connection errors. How are the two applications supposed to be run together?

$ ./HelloWorldQueuePub tcp:127.0.0.1:55555 vpn_ user_name queue_name

SDK NOTICE Fri Dec 03 14:40:05.883 2021 solClient.c:10681                    (7f0bfb541700) Session '(c0,s1)_vpn_' error attempting transport connection, client name 'XXXXXX/38148/00000001/TG-HrIQ754', VPN name 'vpn_', peer host 'tcp:127.0.0.1:55555' address 'IP 127.0.0.1', connection 'tcp_TxRx' local address 'IP 127.0.0.1:4234'
SDK NOTICE Fri Dec 03 14:40:05.884 2021 solClient.c:10209                    (7f0bfb541700) Protocol or communication error when attempting to login for session '(c0,s1)_vpn_'; are session HOST and PORT correct? client name 'XXXXXX/38148/00000001/TG-HrIQ754', VPN name 'vpn_', peer host 'tcp:127.0.0.1:55555' address 'IP 127.0.0.1', connection 'tcp_TxRx' local address 'IP 127.0.0.1:4234'

Answers

  • ivan_lkc
    ivan_lkc Member Posts: 11 ✭✭

    You are connecting to "127.0.0.1:55555", which implys you need to have a Solace Broker running on your local computer over port 55555. Simply running the Publisher and/or the Subscriber code won't magically create the required broker.

  • shashank
    shashank Member Posts: 3

    In that case, what would be the recommended way to test this integrated flow locally. I have tested the integrated flow by connecting to broker, but the broker connectivity is sporadic and I wanted to add some tests that I can run on my machine.

    Is there a way I can create a mock Solace broker locally on my machine which can simulate the actual broker and send guaranteed messages on a queue?

    And if not locally, is there a way to create a remote Solace broker, which can behave like a mock broker for my testing?

  • ivan_lkc
    ivan_lkc Member Posts: 11 ✭✭

    If you can understand Java, I suggest you read this: https://solace.community/discussion/493/integration-functional-testing-with-junit-and-solace

    Otherwise, the idea is simple,
    (1) Write some code/scripts to instruct Docker to summon a locally running Solace Broker, and destroy it after you finished with it.
    (2) Integrate such steps into your automatic testing work flow.