Uploaded image for project: 'AMQ Clients'
  1. AMQ Clients
  2. ENTMQCL-500

[dotnet] Receive does not raise exception when link closed with error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.0.0.B1
    • 1.1.0-GA
    • amqp-dotnet-client
    • None
    • Release Notes
    • Pipelined protocol state events can prevent the client from raising link errors to the API user. Notification of errors may occur in subsequent event handling functions.
    • Documented as Known Issue
    • January 2018

      .net lite client doesn't raise exception when receiver with wrong selector starts receiving messages from broker.

      1. When I call receiver.Receive() for the first time, it doesn't raise exception with invalid filter.
      2. When I call receiver.Receive() for second time, it raise AMQPException.
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;
      using System.Transactions;
      using Amqp;
      using Amqp.Framing;
      using Amqp.Types;
      
      namespace test
      {
          class Selectors
          {
              public static void Main(string[] args)
              {
                  Trace.TraceLevel = TraceLevel.Frame;
                  Trace.TraceListener = (f, a) => Console.WriteLine(DateTime.Now.ToString("[hh:ss.fff]") + " " + string.Format(f, a));
      
                  Address address = new Address("amqp://127.0.0.1:5672");
                  string queue = "test";
                  string testName = "Selectors";
      
                  Open open = new Open();
                  open.ContainerId = Guid.NewGuid().ToString();
                  Connection connection = new Connection(address, null, open, null);
                  Session session = new Session(connection);
      
                  ////////////////////////////////////////////////////////////////////////////////////////////////////////
      
                  Source recvSource = new Source();
                  recvSource.Address = queue;
                  Map filters = new Map();
                  filters.Add(new Symbol("filter1"),
                                  new DescribedValue(
                                      new Symbol("apache.org:selector-filter:string"),
                                      "foo/bar"));
                  recvSource.FilterSet = filters;
      
                  Attach attach = new Attach()
                  {
                      Source = recvSource,
                      Target = new Target(),
                  };
      
                  ReceiverLink receiver = new ReceiverLink(session, "receiver-" + testName, attach, (l, a) => { });
      
                  /////////////////////////////////////////////////////////////////////////////////////////////////////////
                  //first try
                  try {
                      Message message = receiver.Receive(1000);
                      Console.WriteLine("Receiver doesn't raise exception");
                  }
                  catch (Exception ex)
                  {
                      Console.WriteLine("Receiver raises exception: {0}", ex.Message);
                  }
      
                  //second try
                  try
                  {
                      Message message = receiver.Receive(1000);
                      Console.WriteLine("Receiver doesn't raise exception");
                  }
                  catch (Exception ex)
                  {
                      Console.WriteLine("Receiver raises exception: {0}", ex.Message);
                  }
      
                  ////////////////////////////////////////////////////////////////////////////////////////////////////////
      
                  receiver.Close();
                  session.Close();
                  connection.Close();
      
                  Console.ReadLine();
              }
          }
      }
      

      client trace

      [02:44.102] SEND AMQP 0 1.0.0
      [02:44.118] SEND (ch=0) open(container-id:e82ab646-6652-4923-a54c-f08f96c4353a)
      [02:44.118] RECV AMQP 0 1 0 0
      [02:44.118] SEND (ch=0) begin(next-outgoing-id:4294967293,incoming-window:2048,outgoing-window:2048,handle-max:4294967295)
      [02:44.133] RECV (ch=0) open(container-id:0.0.0.0,max-frame-size:4294967295,channel-max:65535,idle-time-out:30000,offered-capabilities:[sole-connection-for-container,DELA
      YED_DELIVERY,SHARED-SUBS,ANONYMOUS-RELAY],properties:[product:apache-activemq-artemis,version:2.0.0.amq-700003-redhat-1])
      [02:44.133] SEND (ch=0) attach(name:receiver-Selectors,handle:0,role:True,source:source(address:test,filter:[filter1:foo/bar]),target:target())
      [02:44.133] RECV (ch=0) begin(remote-channel:0,next-outgoing-id:1,incoming-window:2147483647,outgoing-window:2147483647,handle-max:65535)
      [02:44.133] SEND (ch=0) flow(next-in-id:0,in-window:2048,next-out-id:4294967293,out-window:2048,handle:0,delivery-count:0,link-credit:200,drain:False)
      [02:44.133] RECV (ch=0) attach(name:receiver-Selectors,handle:0,role:False,snd-settle-mode:2,rcv-settle-mode:0,target:target(),incomplete-unsettled:False,initial-delivery
      -count:0)
      [02:44.149] RECV (ch=0) detach(handle:0,closed:True,error:error(condition:amqp:invalid-field,description:Invalid filter))
      [02:44.149] SEND (ch=0) detach(handle:0,closed:True)
      Receiver doesn't raise exception
      Receiver raises exception: Invalid filter
      [02:44.149] SEND (ch=0) end()
      [02:44.149] RECV (ch=0) end()
      [02:44.165] SEND (ch=0) close()
      [02:44.165] RECV (ch=0) close()
      

              crolke@redhat.com Chuck Rolke (Inactive)
              dkornel@redhat.com David Kornel
              David Kornel David Kornel
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: