amareshmad opened a new issue, #114:
URL: https://github.com/apache/pulsar-dotpulsar/issues/114

   **When I create .NET framework/.net core console app, I could be able to 
create a client and able to create consumer and receiving the messages as well 
but when I integrate it into my actual project it is not building the consumer 
**
   
   For the first time from console got the issue 
DotPulsar.Exceptions.ChannelNotReadyException: The channnel is not ready yet 
later it is not generated, created the consumer and able consume messages
   
   when I integrated same code with my actual project which supposed to create 
consumer, it is not creating the client consumer.
   I always getting the exceptin DotPulsar.Exceptions.ChannelNotReadyException: 
The channnel is not ready yet
   
   DotPulsar.Exceptions.ChannelNotReadyException: The channnel is not ready yet
   at DotPulsar.Internal.NotReadyChannel1.Receive(CancellationToken 
cancellationToken) at DotPulsar.Internal.Consumer1.d__24.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at 
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
 task)
   at System.Threading.Tasks.ValueTask1.get_Result() at 
System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable1.ConfiguredValueTaskAwaiter.GetResult()
   at DotPulsar.Internal.Executor.d__9`1.MoveNext()
   
   More info
   both test app & actual product code are running in same machine.
   .Net framework :4.8
   Installed .net core sdk 6.0
   
   async Task TestConsumer(){
   const string myTopic = "global.qa.xxxxRequestV1.Queue";
   
           string SERVICE_URL = "pulsar+ssl://xxxxx.xxxx.com:6651";
           string username = "xxxxxxx";
           string password = "xxxxxxxx";
           Uri sURl = new(SERVICE_URL);
   
           Console.WriteLine($"Build consumer client.....");
           ExceptionHandler pException = new ExceptionHandler();
   
           await using var client = PulsarClient.Builder()
                                                .Authentication(new 
AuthenticationBasic(username, password))
                                                .ServiceUrl(sURl)
                                                .VerifyCertificateName(false)
                                                
.VerifyCertificateAuthority(false)
                                                
.ExceptionHandler(pException.OnException)
                                                 .Build();
           
           Console.WriteLine($"creating Consumer.......");
           await using var consumer = client.NewConsumer()
                                            .Topic(myTopic)
                                            
.SubscriptionType(SubscriptionType.Shared)
                                            .SubscriptionName("xxxxxxxxxxxxxxxx)
                                            .Create();
   
           Console.WriteLine($"Waiting for consumer message.......");
           await foreach (var message in consumer.Messages())
           {
               Console.WriteLine($"Received consumer: 
{Encoding.UTF8.GetString(message.Data.ToArray())}");
   
               await consumer.Acknowledge(message);
           }
   }
   
   public class AuthenticationBasic : IAuthentication
   {
       private string username;
       private string password;
       public AuthenticationBasic(string uname, string passwd)
       {
           username = uname;
           password = passwd;
       }
   
       public string AuthenticationMethodName
       {
           get { return "oms3.0"; }
       }
   
       public ValueTask<byte[]> GetAuthenticationData(CancellationToken 
cancellationToken)
       {
           return new ValueTask<byte[]>(Encoding.UTF8.GetBytes(username + ":" + 
password));
       }
   }
   
   public interface IHandleException
   {
       /// <summary>
       /// Called after an action has thrown an Exception.
       /// </summary>
       ValueTask OnException(ExceptionContext exceptionContext);
   }
   
   public class ExceptionHandler : IHandleException
   {
       //static private readonly ILog log = 
LogManager.GetLogger(typeof(DESPulsarQueue));
   
       public ValueTask OnException(ExceptionContext exceptionContext)
       {
           Console.WriteLine("An error occured while creating pulsar 
client:{0}", exceptionContext.Exception.StackTrace.ToString());
           return new ValueTask();
       }
   }


-- 
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.

To unsubscribe, e-mail: dev-unsubscr...@pulsar.apache.org.apache.org

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

Reply via email to