Skip to content

OnRequestReceived event triggered only 1 time. #234

@imaeo

Description

@imaeo

(Receiving side) launch project coded like following.
(Sending side ) another process requests "WhoIsThereRequest " through ExecuteRequest().
Receiving side respond to the request, and Sending side receives the response.
But, one more time sending side perform same request, no response returned.
From monitoring receiving side, OnRequestReceived event is not triggered (set breakpoint on head of event, not triggered).
Message can receive only 1 time in receiving side.

What is mistaken?

namespace WindowsFormsApp1 {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();

            GoListener();
        }
        private static AmqpCFXEndpoint thisEndpoint;
        private const string strCfxHandle = "CFX.TEST.MACHINE";
        private const string strRequestUri = "amqp://127.0.0.1:8230";
       
        private void GoListener() {
            thisEndpoint = new AmqpCFXEndpoint();
            thisEndpoint.OnRequestReceived -= OnRequestReceivedFunc;
            thisEndpoint.OnRequestReceived += OnRequestReceivedFunc;

            thisEndpoint.Open(strCfxHandle, new Uri(strRequestUri));
        }
        private CFXEnvelope OnRequestReceivedFunc(CFXEnvelope message) {
            CFXEnvelope result = null;
            if (message.MessageBody is WhoIsThereRequest ) {
                result = CFXEnvelope.FromCFXMessage(new WhoIsThereResponse() {
                    CFXHandle = strCfxHandle,
                    RequestNetworkUri = strRequestUri,
                    RequestTargetAddress = ""
                });
            } else {
                return result;
            }
            result.Source = strCfxHandle;
            result.Target = strCfxHandle;
            result.TimeStamp = DateTime.Now;
            return result;
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions