amareshmad commented on issue #114:
URL:
https://github.com/apache/pulsar-dotpulsar/issues/114#issuecomment-1277478288
Windows app. Running in windows server 2016.
Test apps also running in same windows server 2016.
Producer .net framework test console
Class ProductMainClass{
public async System.Threading.Tasks.Task CreateProducer(string queueName)
{
var cts = new CancellationTokenSource();
Console.CancelKeyPress += (sender, args) =>
{
cts.Cancel();
args.Cancel = true;
};
const string myTopic = "persistent://xxxxxxxxxxxxx";
string SERVICE_URL = "pulsar+ssl://xxxxxx:6651";
string username = "xxxxxx";
string password = "xxxxxxxxxxxxxxxxxxxxxx";
Uri sURl = new(SERVICE_URL);
log.Info($"build producer client");
ExceptionHandler pException = new ExceptionHandler();
await using var client = PulsarClient.Builder()
.Authentication(new
AuthenticationBasic(username, password))
.ServiceUrl(sURl)
.ExceptionHandler(pException.OnException)
.Build();
log.Info($"creating producer.......");
await using var producer = client.NewProducer(Schema.String)
.Topic(myTopic)
.StateChangedHandler(Monitor)
.Create();
log.Info($"waiting for producer .......");
await ProduceMessages((IProducer<string>)producer, cts.Token);
}
private static void Monitor(ProducerStateChanged
stateChanged)
{
var topic = stateChanged.Producer.Topic;
var state = stateChanged.ProducerState;
log.InfoFormat($"The producer for topic '{topic}' changed state
to '{state}'");
}
}
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)
{
log.Error("An error occured while creating pulsar client",
exceptionContext.Exception);
return new ValueTask();
}
}
It is able to create producer & its status is Connected.
When i integrate same into my actual product code I can see below error
at System.Net.Security.SslState.ValidateCreateContext(Boolean isServer,
String targetHost, SslProtocols enabledSslProtocols, X509Certificate
serverCertificate, X509CertificateCollection clientCertificates, Boolean
remoteCertRequired, Boolean checkCertRevocationStatus, Boolean checkCertName)
at System.Net.Security.SslStream.BeginAuthenticateAsClient(String
targetHost, X509CertificateCollection clientCertificates, SslProtocols
enabledSslProtocols, Boolean checkCertificateRevocation, AsyncCallback
asyncCallback, Object asyncState)
at
System.Net.Security.SslStream.<>c__DisplayClass32_0.<AuthenticateAsClientAsync>b__0(AsyncCallback
callback, Object state)
at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl(Func`3 beginMethod,
Func`2 endFunction, Action`1 endAction, Object state, TaskCreationOptions
creationOptions)
at System.Net.Security.SslStream.AuthenticateAsClientAsync(String
targetHost, X509CertificateCollection clientCertificates, SslProtocols
enabledSslProtocols, Boolean checkCertificateRevocation)
at DotPulsar.Internal.Connector.<EncryptStream>d__7.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at
System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at DotPulsar.Internal.Connector.<Connect>d__5.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at
System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at
DotPulsar.Internal.ConnectionPool.<EstablishNewConnection>d__17.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at
System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at DotPulsar.Internal.ConnectionPool.<GetConnection>d__16.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at System.Threading.Tasks.ValueTask`1.get_Result()
at DotPulsar.Internal.ConnectionPool.<GetConnection>d__15.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at System.Threading.Tasks.ValueTask`1.get_Result()
at
DotPulsar.Internal.ConnectionPool.<FindConnectionForTopic>d__13.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at System.Threading.Tasks.ValueTask`1.get_Result()
at DotPulsar.Internal.Producer`1.<GetNumberOfPartitions>d__27.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at
System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at DotPulsar.Internal.Producer`1.<Monitor>d__25.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task)
at
System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at DotPulsar.Internal.Executor.<Execute>d__5.MoveNext()
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]