You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/09/01 13:46:46 UTC

[GitHub] [pulsar-dotpulsar] lee-chrisbell opened a new issue #51: SetupChannel exceptions

lee-chrisbell opened a new issue #51:
URL: https://github.com/apache/pulsar-dotpulsar/issues/51


   When SetupChannel throws an exception, the application crashes because the method is async void.  
   
   I propose catching exceptions in this method and setting the ConsumerState or ProducerState to faulted.
   
   ```c#
   private async void SetupChannel()
   {
       try
       {
           var channel = await _factory.Create(CancellationTokenSource.Token).ConfigureAwait(false);
           await _consumer.SetChannel(channel).ConfigureAwait(false);
       }
       catch(Exception ex)
       {
           Console.WriteLine($"Consumer state is now faulted \n {ex.ToString()}");
           _stateManager.SetState(ConsumerState.Faulted);
       }
   }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar-dotpulsar] blankensteiner commented on issue #51: SetupChannel exceptions

Posted by GitBox <gi...@apache.org>.
blankensteiner commented on issue #51:
URL: https://github.com/apache/pulsar-dotpulsar/issues/51#issuecomment-685418292


   Hi @lee-chrisbell 
   Good point! 
   The state should be set to 'faulted' elsewhere if _factory.Create throws an exception, so maybe just catch and ignore the exception?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar-dotpulsar] lee-chrisbell closed issue #51: SetupChannel exceptions

Posted by GitBox <gi...@apache.org>.
lee-chrisbell closed issue #51:
URL: https://github.com/apache/pulsar-dotpulsar/issues/51


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar-dotpulsar] lee-chrisbell commented on issue #51: SetupChannel exceptions

Posted by GitBox <gi...@apache.org>.
lee-chrisbell commented on issue #51:
URL: https://github.com/apache/pulsar-dotpulsar/issues/51#issuecomment-685725565


   I submitted a PR for the change.  I removed the SetState call from my suggestion and changed the console output a bit.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar-dotpulsar] lee-chrisbell commented on issue #51: SetupChannel exceptions

Posted by GitBox <gi...@apache.org>.
lee-chrisbell commented on issue #51:
URL: https://github.com/apache/pulsar-dotpulsar/issues/51#issuecomment-685720129


   Ah I did not realize that.  Yeah makes sense.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org