Ejemplo n.º 1
0
        public Task Ping()
        {
            return(_endpoint.Ping(channel =>
            {
                var envelope = Envelope.ForPing(Destination);

                var props = _endpoint.Channel.CreateBasicProperties();

                _protocol.WriteFromEnvelope(envelope, props);
                props.AppId = "Jasper";

                channel.BasicPublish(_address, props, envelope.Data);
            }));
        }
Ejemplo n.º 2
0
        private async Task send(Envelope envelope)
        {
            if (State == AgentState.Disconnected)
            {
                throw new InvalidOperationException($"The RabbitMQ agent for {Destination} is disconnected");
            }

            try
            {
                var props = Channel.CreateBasicProperties();
                props.Persistent = _isDurable;

                _protocol.WriteFromEnvelope(envelope, props);

                Channel.BasicPublish(_exchangeName, _key, props, envelope.Data);

                await _callback.Successful(envelope);
            }
            catch (Exception e)
            {
                try
                {
                    await _callback.ProcessingFailure(envelope, e);
                }
                catch (Exception exception)
                {
                    _logger.LogException(exception);
                }
            }
        }
Ejemplo n.º 3
0
#pragma warning disable 1998
        public async Task Send(Envelope envelope)
#pragma warning restore 1998
        {
            EnsureConnected();

            if (State == AgentState.Disconnected)
            {
                throw new InvalidOperationException($"The RabbitMQ agent for {Destination} is disconnected");
            }

            var props = Channel.CreateBasicProperties();

            props.Persistent = _isDurable;

            _protocol.WriteFromEnvelope(envelope, props);

            Channel.BasicPublish(_exchangeName, _key, props, envelope.Data);
        }