Git Product home page Git Product logo

Comments (9)

alexisfouqueteuroplacer avatar alexisfouqueteuroplacer commented on August 29, 2024

Hi

I assume you are not receiving the request on your receiving endpoint?
Do you see the messages in the queue tab of RabbitMQ as well ?
Do you see your receiving endpoint in the connexions tab of RabbitMQ?

I don't see obvious error, except that you don't set any certificate, and when you use https addresses, a certificate is needed by default.
Try to do endpoint.ValidateCertificates = false before both endpoint.open(...).

I hope it helps

Alexis

from cfx.

tomekj320 avatar tomekj320 commented on August 29, 2024

@alexisfouqueteuroplacer
Thank you for your respond.

Yes, that is correct I don't receive the message's at the endpoint side.
There is something happening in the queue side of things Whenever a send a message a new queue is created with a strange name ( example: amq.gen-FJGpmhs7q9QYuKRfaAhVWw)
However, the message is sent to the correct queue ( CFXQueue ).
Capture
Capture

No, I don't see any connections in the connections tab of CFX.

I've tried your suggestion but sadly it didn't change my situation.

from cfx.

alexisfouqueteuroplacer avatar alexisfouqueteuroplacer commented on August 29, 2024

After a second look I think this line is wrong :
request.Target = amqpTarget;

The target here should be the target cfx handle, not the name of the exchange.

from cfx.

tomekj320 avatar tomekj320 commented on August 29, 2024

@alexisfouqueteuroplacer

I've tried it with both the handle and the name of the exchange , both dont seem to work for me.

from cfx.

QuantaVn avatar QuantaVn commented on August 29, 2024

Because CFX SDK uses AMQP.Net Lite library, it will open a socket when sending direct Request to an Endpoint.
In order to work with Request/Response in the same machine (with the same IP as yours: 192.168.1.52), you need to use different ports.
As you can see in my example, when an Endpoint want to send a Request to an MES Simulator, the Endpoint need to know the CFX Handle and Network Uri of the MES Simulator:
image
And here is my code to send Request:

        private async Task RunAsyncRequest()
        {
            // Send Request/Reponse pattern command, and ensure response
            CFXEnvelope req = new CFXEnvelope(new AreYouThereRequest() { CFXHandle = txtMESHandle.Text });
            req.Source = endpoint.CFXHandle;
            req.Target = txtMESHandle.Text;
            CFXEnvelope resp = await endpoint.ExecuteRequestAsync(txtMESUri.Text, req);
            AddToResults($"REQUEST SENT:\n {req.ToJson(true)}");
            if (resp != null)
            {
                AddToResults($"RESPONSE RECEIVED:\n {resp.ToJson(true)}");
            }
        }

(Note: amqp://localhost:5672 is the default Uri of RabbitMQ installed in my laptop)

from cfx.

tomekj320 avatar tomekj320 commented on August 29, 2024

@QuantaVn
Thank you for your response.

I'm not quite sure how to achieve the connection perhaps you can explain this a bit more. My situation is not fully localhost based.
I have the AMQP server running on a different pc ( 192.168.1.52:5672 ) and both the sender and receiver are running on my own laptop ( 192.168.1.44 ).

Recieve:
`
AmqpCFXEndpoint endpoint = new AmqpCFXEndpoint();

        myRequestUri = new Uri(string.Format("amqp://{0}", "192.168.1.44:54243"));

        endpoint.OnConnectionEvent += Endpoint_OnConnectionEvent;
        endpoint.Open("Vendor2.Model2.Machine55", myRequestUri);

        // Encode your username and password into the destination Uri
        string username = "newadmin";
        string password = "s0m3p4ssw0rd";
        string hostname = "192.168.1.52:5672";

        //  eg.  amqps://myusername:[email protected]
        Uri uri = new Uri(string.Format("amqp://{0}:{1}@{2}", username, password, hostname));

        // Source queue on broker (shown here in RabbitMQ compatible format)
        string amqpSource = "/queue/CFXQueque";
        endpoint.OnRequestReceived += Endpoint_OnRequestReceived;
        endpoint.AddSubscribeChannel(uri, amqpSource);

`

Send:
`
endpoint.OnConnectionEvent += Endpoint_OnConnectionEvent;
Uri myRequestUri = new Uri(string.Format("amqp://{0}", "192.168.1.44:54244"));
endpoint.Open("Vendor1.Model1.Machine34", myRequestUri);

        // Encode your username and password into the destination Uri
        string username = "newadmin";
        string password = "s0m3p4ssw0rd";
        string hostname = "192.168.1.52.5672";
        
        //  eg.  amqps://myusername:[email protected]
        Uri uri = new Uri(string.Format("amqp://{0}:{1}@{2}", username, password, hostname));

        // Target exchange on broker (shown here in RabbitMQ compatible format)
        string amqpTarget = "/exchange/CFXExchange";
        endpoint.AddPublishChannel(uri, amqpTarget);

`

So after implementing your suggestion, I have this. But I'm noticing 2 things.

  1. Receive do's connect to the AMQP server but is shown in the connection tab with a completely different port that is set during opening.
  2. Send never trigger's the connection event.

from cfx.

simon-smith avatar simon-smith commented on August 29, 2024

Hi
If you are still having issues the attached code might help you out. This is my CFX Client test program. It listens to the RabbitMQ and reads messages and displays them.
Also are you sure that your RabbitMQ is correctly configured? It is not uncommon for the setup to be tricky to get right. There is a document on the IPC-CFX website explaining the setup. https://cfx.ipc.org/files/IPC-CFX-AMQP-Guide-v1_0.pdf
CFXClient.zip

I hope this helps.
Simon

from cfx.

QuantaVn avatar QuantaVn commented on August 29, 2024

@tomekj320 : Actually, as I mentioned, because CFX SDK using AMQP.Net Lite library, the RabbitMQ doesn't have any role in the direct communication between your Receiver and Sender. RabbitMQ has responsibility only for Publish/Subscribe communication. (You can try comment out the AddPublishChannel() and AddSubscribeChannel() for testing direct communication)
The Receiver opens its host and port and waits for incoming Requests. The Sender must know the Receiver's host & port to send Requests. That's all.

from cfx.

HaythemLtifi avatar HaythemLtifi commented on August 29, 2024

same probelm, it create a new queue of its own. any idea on how to fix this please?

image

from cfx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.