c# - IBM MQSeries Accessing Issue from .NET -
I am not very familiar with IBM amuaries, but I am writing C # scripts that write and read files from my queue server. The problem is my reading job but my writing is not. Please note that I am using the same queue, so do not bother going in that direction.
My code first accesses MQserver with the following code:
MQQueueManager qManager; MQQueue queue; Amcusage queue message; MQGetMessage option queue message message option; MQPutMessage Option QuipTemesque Option; String queue name; Public MQAccess (string queue name, string queue manager, string connection, string channel) {queueName = queueName; QManager = new MQQueueManager (quencher, channel, connection); Q = qManager.AccessQueue (QN, MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING); }
I am able to read files from my queue from this Qi:
Public Ball Next Message (Riff String Message, Referee DateTime putDateTime) { QueueMessage = new MQMessage (); Q Message Format = MQC.MQFMT_STRING; Queuegate message option = new MQGetMessageOptions (); Queuegatemosesopt Option = MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING; Try {queue.get (que message, quizette message option); } Hold (MQException mkx) {if (mqex.ResonCode == MQC.MQRC_NO_MSG_AVAILABLE) {message = ""; return false; } And throw mcx; } Message = queueMessage.ReadString (queueMessage.MessageLength); PutDateTime = queueMessage.PutDateTime; If (the message "wires" ("'")) {message = message.Substring (3, message .length - 3);} back true;}
If I write the following code If I try, I get errors:
Public Zero WriteMessage (string message) {queueMessage = new MQMessage ()); queueMessage.WriteString (message); Q message format = MQC.MQFMT_STRING ; QiPutMessage Option = New MQPutMessageOptions (); Queue.Patt (Qi message, QiPutMess option);}
Holding my error gives me an error:
< P> error in the application
which does not show much because I checked the event log on the server and this showed me the error:
TCP / There was an error in getting the data from the stx041774 (192.168.225.51) on the IP. This may be due to the communication failure
Return code from TCP / IP (REV) call 10054 (x296) Record these values and tell the system administrator.
I saw 10054 And it means:
Remote Host An existing connection was forcibly closed. Do anyone know what I can do to do this work? Is there any MQC option to write to me? Because I do not know what to do with the options, I'm also not sure whether this is a problem.
Please keep in mind that I close my connection at all times:
Close public zeros () {queueMessage = null; Queue.Close (); QManager.Close (); } ~ MQAccess () {queueMessage = null; Queue.Close (); QManager.Close (); }
Squig was off but there was no cigar when you open the queue Both the input and output on the open options must be specified if you both want to read and write the message in the example code only the input options are specified.