thread entry
Open(ConnectionMode.Read);
loop when it is not cancelled
var message = GetMessage();
queueManager.Commit();
Loop end
queue.Close();
queueManager.Disconnect();
thread exit
public string GetMessage()
{
const int MaxMessageSizeInBytes = 8000;
const int ReadTimeoutInMilliseconds = 3000;
message = new MQMessage { Format = MQC.MQFMT_STRING };
var mqMessageOptions = new MQGetMessageOptions
{
WaitInterval = ReadTimeoutInMilliseconds,
Options = MQC.MQGMO_WAIT | MQC.MQGMO_FAIL_IF_QUIESCING
| MQC.MQGMO_SYNCPOINT //use syncpoint for consumer acknowledgment
};
var content = message.ReadString(message.MessageLength);
message.ClearMessage();
return content;
}
public IMessage Get()
{
var mqMessage = new MQMessage { Format = MQC.MQFMT_STRING };
var mqMessageOptions = new MQGetMessageOptions
{
WaitInterval = ReadTimeoutInMilliseconds,
Options = MQC.MQGMO_WAIT | MQC.MQGMO_FAIL_IF_QUIESCING | MQC.MQGMO_SYNCPOINT
};
Connection.MqQueue.Get(mqMessage, mqMessageOptions, MaxMessageSizeInBytes);
return mqMessage.MapToMessage();
}
public void Open(connectionMode connectionMode)
{
var connectionSettings = new Hashtable
{
{MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED },
{MQC.CONNECT_OPTIONS_PROPERTY, MQC.MQCNO_RECONNECT }
};
int openOptions = 0;
switch (connectionMode)
{
case connectionMode.Read:
openOptions = MQC.MQOO_INPUT_SHARED + MQC.MQOO_FAIL_IF_QUIESCING;
break;
case connectionMode.Write:
openOptions = MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING;
break;
}
MqQueueManager = new MQQueueManager(_queueManagerName, connectionSettings);
MqQueue = MqQueueManager.AccessQueue(_queueName, openOptions);
}
这是Debug消息的一部分。第一次绑定是否成功?
Got Ldap context on server
答案 0 :(得分:0)
没有。 看起来LDAP凭据错误:"无法登录。无效的用户名/密码组合"