Я создал пользовательскую привязку (System.ServiceModel.Channels.Binding) для BizTalk на основе RabbitMQ.ServiceModel
https://github.com/CymaticLabs/Unity3D.Amqp/tree/master/lib/rabbitmq-dotnet-client-rabbitmq_v3_4_4/projects/wcf/RabbitMQ.ServiceModel/src/serviceModel
Я пытаюсь отключить мое место получения, когда очередь не существует.
Я могу определить, что в public override void Open(TimeSpan timeout)
в RabbitMQInputChannel.cs
отсутствует очередь, но я не знаю, как отключить мое местоположение приема.
https://github.com/CymaticLabs/Unity3D.Amqp/blob/master/lib/rabbitmq-dotnet-client-rabbitmq_v3_4_4/projects/wcf/RabbitMQ.ServiceModel/src/serviceModel/RabbitMQInputChannel.cs
namespace RabbitMQ.ServiceModel
{
internal sealed class RabbitMQInputChannel : RabbitMQInputChannelBase // Implement interface IChannel and IInputChannel
{
[...]
public override void Open(TimeSpan timeout)
{
try
{
if (State != CommunicationState.Created && State != CommunicationState.Closed)
{
this.Close();
throw new InvalidOperationException(string.Format("Cannot open the channel from the {0} state.", base.State));
}
OnOpening();
string queueName = m_bindingElement.QueueName;
string key = m_bindingElement.RoutingKey == null ? string.Empty : m_bindingElement.RoutingKey;
string exchange = m_bindingElement.ExchangeName;
if (m_bindingElement.QueueDeclare)
{
try
{
m_model.QueueDeclare(queueName, true, false, false, null);
}
catch (Exception ex)
{
}
}
//Listen to the queue
m_consumer = new EventingBasicConsumer(m_model);
m_consumer.ConsumerCancelled += OnConsumerCancelled;
m_consumer.Received += (sender, args) => m_queue.Add(args);
m_model.BasicConsume(queueName, false, m_consumer);
OnOpened();
}
catch(Exception ex)
{
EventLogHelper.WriteError(ex.Message);
this.Close();
}
}
private void OnConsumerCancelled(object sender, ConsumerEventArgs e)
{
// HERE I WANT TO DISABLE MY RECEIVE LOCATION
}
}
}