RDP is up and running still message is not redirected to the consumer.

Saurabh
Saurabh Member Posts: 10

followed https://solace.com/samples/solace-samples-rest-messaging/publish-subscribe/ though server is up and running rdp is not able to forward message to the consumer(comes in queue) whereas directly posting a message to this nodeJs server is working fine.

Tagged:

Comments

  • TomF
    TomF Member, Employee Posts: 406 Solace Employee

    Hi @Saurabh, let's do some debug to narrow down where the problem is. In PubSub+ Manager, go to "Client Connections." Select the "REST" tab at the top, and you should see your RDP listed. Check the "Operational State" and "Enabled". If Enabled is Yes and Operational State is down, it's possible the Rest Consumer isn't enabled. Click on the RDP and you'll enter the RDP edit screen, where the Rest Consumers are listed. You should see that it is enabled. If not, please enable that too.

  • Saurabh
    Saurabh Member Posts: 10

    Hi TomF,
    Thanks for response.
    RDP is enabled and operational state is up for both RDP and Consumer. I have attached screenshot for both.

    Time Connections blocked(%) is 99, is this ok?

    Thanks & Regards,
    Saurabh

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 914 admin

    Hi @Saurabh ,
    That doesn't seem ok to me. When I test an endpoint that works (postman-echo for example) my Time Connections blocked is 0.
    I'm wondering if your broker can reach the REST endpoint or if the endpoint is doing mutual auth and rejecting the request from the broker. If you look on the REST Consumer under Stats -> Details it should show some info about the Last Failure which might help.
    -Marc

  • Saurabh
    Saurabh Member Posts: 10

    Hi Marc,

    I can see below info in details. As you said even I am sure this is not reaching to the REST endpoint, please let me know how to resolve this.
    Operational State
    Up
    Last Failure
    Reason
    No Consumer Connections Up
    Time
    2020-06-20 04:29:13
    Last Connection Failure
    Local Endpoint
    192.168.1.7:39445
    Remote Endpoint
    127.0.0.1:8080
    Reason
    HTTP/1.0 Or Connection:Close
    Time
    2020-06-20 04:26:15
    Outgoing Connections (Up/Configured)
    3 of 3

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 508 admin

    Hi @Saurabh ... why does it show "127.0.0.1:8080" as your remote endpoint? If your Solace broker is running on your local laptop, then that's the address for the PubSub+ manager. Or do you have something else running on port 8080 on localhost?

  • Saurabh
    Saurabh Member Posts: 10

    Hi Aaron,

    Thanks for reply.
    Yes, solace broker is running on my local laptop and in my local laptop I have created one nodeJS server as demonstrated in tutorial.
    var http = require('http');
    var port='8080';
    var host='127.0.0.1';
    http.createServer(function (req, res) {
    console.log('Received message: ' + req.url);
    res.writeHead(200);
    res.end();
    }).listen(port, host);
    console.log('RUNNING ON '+host+':'+port);

    Even I tried localhost:7001 where my one more REST application is up and running but getting same issue for this as well.

    Thanks & Regards,
    Saurabh

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 508 admin

    Ok. But is there a port conflict since the Solace broker uses port 8080..? What happens when you point your browser to port 8080? Is it the PubSub+ Manager GUI? Or your Node app?

    I think you need to run your Node app on a port that's not being used by other applications. And then change your REST Consumer settings to goto that port.

  • Saurabh
    Saurabh Member Posts: 10

    Hi Aaron,

    I have changed the port to 8081 and server is running as well.

    but the moment I update the consumer port number, RDP is going down.

    Even I get the same issue with one more rest application running on my localhost at port 7001. RDP going down after updating host and port though consumer is up and running.

    Thanks & Regards,
    Saurabh

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 508 admin

    Ok... I don't know NodeJS, but I went and tried this sample out. Below is my changes to the sample code to make it work for me:

    var http = require('http');
    
    var RC_PORT = 9123;
    var RC_HOST = '127.0.0.1';
    
    http.createServer(function (req, res) {
                console.log('Received message: ' + req.url);
                res.writeHead(200);
                res.end();
    }).listen(RC_PORT,RC_HOST);
    console.log('Server running at http://'+RC_HOST+':'+RC_PORT+'/');
    

    And then when I run it, it starts up, and if i put "localhost:9123" into my browser, I see the following output:

    nodejs ./NodeServer.js
    Server running at http://127.0.0.1:9123/
    
    
    Received message: /
    Received message: /favicon.ico
    

    Can you confirm that your output is similar? I haven't tried pointing my RDP REST Consumer to this yet, but you need to ensure the NodeJS mini server app is up and running correctly.

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 508 admin

    Ok, I'm seeing what you're seeing. I'm going to try some more experiments.

  • Saurabh
    Saurabh Member Posts: 10

    Hi Aaron,

    Yes, my output is also same. Even I tried calling this mini nodeJS server directly from POSTMAN and its working absolutely fine.
    This problem is not only with nodeJS server but I tried one REST application installed in weblogic server at 7001 port, here also I am getting the same issue.

    Note: I am able to ping both hosts from windows cmd prompt and from solace.

    Thanks & Regards,
    Saurabh

  • Saurabh
    Saurabh Member Posts: 10

    Hello,
    Any suggestion? tried many things but still not working.
    Thanks & Regards,
    Saurabh

  • arih
    arih Member, Employee Posts: 125 Solace Employee

    Hi @Saurabh

    Trying to catch up here, when you said you are able to ping both hosts from solace, how did you actually do that? And are you running Solace PubSub+ with docker or VM?

    I'm suspecting that if you're running Solace PubSub+ with docker or VM, then 127.0.0.1 will be the container's or guest-VM's, not your laptop (host OS). When you used 8080, it was up because you do have 8080 running there, which is the PubSub+ Web Manager, but not 8081 which is running in your host (outside of the container/VM). Just a guess :)

  • Saurabh
    Saurabh Member Posts: 10

    Hi Arih,

    I have installed solace in my local in oracle VM. I pinged both the IP's from solace cmd prompt.

    it's not connecting with other IP and port also running in host OS, RDP itself is not coming up.

    Thanks & Regards,
    Saurabh

  • arih
    arih Member, Employee Posts: 125 Solace Employee

    Hi Saurabh,

    Is it Oracle VirtualBox and you're using Solace OVA template? Usually it will give you sysadmin@solace, but just checking.

    And your host OS is Windows right? Am I right to assume that your Node.js sample REST service is running in your Windows?

    Ping 127.0.0.1 will always succeed since that IP is the loopback IP. Can you run ip -a from your solace and share the output?

  • arih
    arih Member, Employee Posts: 125 Solace Employee

    This is how my Solace PubSub+ is set up with my VirtualBox.

    If yours are the same, then you just need to find out what is the IP address of your host. In my case en0 (wifi wireless) and use that IP for my RDP remote endpoint instead of 127.0.0.1.

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 508 admin

    Hi @Saurabh ... apologies for not following up on this. Yes, I just did what Ari suggested, and changed my Node JS server to use my actual IP address (10.1.1.245), restarted it, and then changed the REST Consumer in Solace to use that as the outbound host:

    C:\Users\AaronLee>ipconfig
    
    Ethernet adapter Ethernet 3:
    
       Connection-specific DNS Suffix  . : lan
       IPv6 Address. . . . . . . . . . . : fd31:d95e:9a75:0:7c5a:4c1a:fe43:5f12
       Temporary IPv6 Address. . . . . . : fd31:d95e:9a75:0:41f6:54df:90bf:35a6
       Link-local IPv6 Address . . . . . : fe80::7c5a:4c1a:fe43:5f12%17
       IPv4 Address. . . . . . . . . . . : 10.1.1.245
       Subnet Mask . . . . . . . . . . . : 255.255.255.0
       Default Gateway . . . . . . . . . : 10.1.1.1
    
    Aaron's Yoga v2:~/node % node NodeServer.js
    Server running at http://10.1.1.245:9090/
    
    Received message: /rest/tutorial
    

  • Saurabh
    Saurabh Member Posts: 10

    Hi Ari/Aaron,

    Yes, Oracle VirtualBox and I am using Solace OVA template and my host OS is windows and nodeJS server also running on the same server. please find below screenshots for network and IP.


    After using actual ipv4 address consumer is not coming up.


    I have attached all possible screenshots, I may be still doing some mistake. Please let me know.

    Thanks & Regards,
    Saurabh

  • arih
    arih Member, Employee Posts: 125 Solace Employee

    Hi @Saurabh
    Can you also take a screenshot of the Stats tab for the RDP and REST Consumer?

  • arih
    arih Member, Employee Posts: 125 Solace Employee

    I would guess that there is just some settings with VirtualBox networking that needs to be resolved.

    Let's do tests step by step:
    1. Make sure the REST API is accessible from your Windows host itself. You can use curl from WSL or simply open 192.168.1.6:9090 from your browser. With Chrome you can run Inspect and make sure you get HTTP 200 OK.
    2. If that works, let's test from within Solace PubSub+ container. First just check if we can ping 192.168.1.6 from your Solace shell.
    3. If that works, let's check the REST port. You can test this by doing curl -v 192.168.1.6:9090 from your Solace shell, just to easily check the connection is there or not.
    4. If that works too, then we need to look at your Solace logs to check :)

    Otherwise you could play around with the Solace Cloud free instance and point out to a dummy REST API server on Internet like http://dummy.restapiexample.com to avoid the networking hassles. For free Solace Cloud instances, just go to console.solace.cloud and create a user.

  • Saurabh
    Saurabh Member Posts: 10

    Hi Ari,
    Please find screenshot of stats below.


    1. REST API is accessible from host and able to get HTTP 200 OK
    2. Able to ping 192.168.1.6 from solace shell.
    3. curl -v 192.168.1.6:9090 from Solace shell is failing, Connection timed out.

    I have also created a cloud account. what port we can give in consumer while using http://dummy.restapiexample.com?

    Thanks & Regards,
    Saurabh

  • arih
    arih Member, Employee Posts: 125 Solace Employee

    Hi @Saurabh ,

    Well we see that there is a connectivity issue here, that's why we still can't get the REST consumer to run. I'm not sure why, but maybe worthwhile to check on your Windows firewall settings.

    If you're testing with a test REST API service, I found out that it might be easier to use postman-echo.com and port 80 for this. And don't forget to change the POST Request Target from /rest/tutorials to /post