Author |
Message
|
AmOnion |
Posted: Thu Oct 19, 2006 6:16 pm Post subject: Segmental Message + MQ DistributionList |
|
|
Newbie
Joined: 17 Oct 2006 Posts: 7
|
I'm a beginner for Websphere MQ. Now I'm coding about put message to DistributionList by vb.net and now I'd like to put segmental Message to DistributionList but I found some problem which is MQMessage of MQAX200 has not property to set for segmental Message so I try to use MQMessage of IBM.WMQ with MQAX200 but it's not work(return 6018 MQRC_NULL_POINTER when sent simple message) So Have anyway to use both together?(Segmental Message + MQ DistributionList)
Could anyone who know about that help me!!!!
Thank you for your attention. I'll look forword for the answer. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Oct 20, 2006 5:16 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Make sure you get your code working for sending a segmented message to one queue.
Then it will work just the same for sending to a distribution list. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
AmOnion |
Posted: Mon Oct 23, 2006 2:21 am Post subject: |
|
|
Newbie
Joined: 17 Oct 2006 Posts: 7
|
yes, I try to sent to only one Queue and it got return code 6018 MQRC_NULL_POINTER so have anyway to do it?  |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Oct 23, 2006 2:41 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Well don't just give us the error and expect us to fix some code you did not provide....  _________________ MQ & Broker admin |
|
Back to top |
|
 |
tleichen |
Posted: Mon Oct 23, 2006 7:56 am Post subject: |
|
|
Yatiri
Joined: 11 Apr 2005 Posts: 663 Location: Center of the USA
|
AmOnion wrote: |
yes, I try to sent to only one Queue and it got return code 6018 MQRC_NULL_POINTER so have anyway to do it?  |
When it says null pointer, it isn't lying to you. You need to troubleshoot your error first.  _________________ IBM Certified MQSeries Specialist
IBM Certified MQSeries Developer |
|
Back to top |
|
 |
AmOnion |
Posted: Mon Oct 23, 2006 7:52 pm Post subject: |
|
|
Newbie
Joined: 17 Oct 2006 Posts: 7
|
Sub PutToQueue(ByVal subdir As SubDirectory, ByVal filename As String)
Dim _subdir As SubDirectory
Dim _distlist As New MQDistributionList
Dim f_stream As StreamReader
Dim mqMsg As New MQMessage
Dim msg, orgfile As String
Dim po As New MQPutMessageOptions
Dim file As File
Try
_subdir = subdir
_distlist = conn(_subdir)
f_stream = New StreamReader(filename, System.Text.Encoding.Default)
orgfile = filename.Substring(filename.LastIndexOf("\"))
mqMsg.ApplicationIdData = orgfile
msg = f_stream.ReadToEnd
f_stream.Close()
mqMsg.MessageData = msg
po.Options = MQPMO_SET_ALL_CONTEXT
_distlist.OpenOptions = MQOO_OUTPUT + MQOO_SET_ALL_CONTEXT + MQOO_FAIL_IF_QUIESCING
_distlist.Open()
_distlist.Put(mqMsg, po)
MessageBox.Show("File put to queue Successful!!!")
If file.Exists(_subdir.Backup & orgfile) = False Then
file.Move(_subdir.Moniter_Path & orgfile, _subdir.Backup & orgfile)
Else
file.Delete(_subdir.Backup & orgfile)
file.Move(_subdir.Moniter_Path & orgfile, _subdir.Backup & orgfile)
End If
MessageBox.Show("Back up Successful!!!")
Catch ex As Exception
If _distlist.CompletionCode = 2 Then
If _distlist.ReasonCode = 2059 Or 2009 Then
MessageBox.Show(_distlist.ReasonCode & " " & _distlist.ReasonName)
Throw New System.Exception(_distlist.ReasonCode)
Else
Throw New System.Exception(_distlist.ReasonName)
End If
Else
Throw ex
End If
Finally
mqQmgr.Disconnect()
End Try
End Sub
Function conn(ByVal _subdir As SubDirectory) As MQDistributionList
Dim mqSess As MQSession
Dim distList As MQDistributionList
Dim qName As String()
Dim distListItem1 As MQDistributionListItem
mqSess = New MQSession
mqQmgr = New MQQueueManager
mqQmgr.name = _subdir.QMGR
distList = New MQDistributionList
distList.ConnectionReference = mqQmgr
qName = _subdir.Q
Dim i As Integer
For i = 0 To qName.Length - 1
distListItem1 = distList.AddDistributionListItem(qName(i), mqQmgr.name)
Next i
distList.OpenOptions = MQOO_OUTPUT + MQOO_SET_ALL_CONTEXT + MQOO_FAIL_IF_QUIESCING
conn = distList
Return conn
End Function
Follow this code it can run normally and got the right output
but when I try to add some feature which is segmental message to the program like this:
Sub PutToQueue(ByVal subdir As SubDirectory, ByVal filename As String)
Dim _subdir As SubDirectory
Dim _distlist As New MQDistributionList
Dim f_stream As StreamReader
Dim mqMsg As New IBM.WMQ.MQMessage
Dim msg, orgfile As String
Dim po As New IBM.WMQ.MQPutMessageOptions
Dim file As File
Try
_subdir = subdir
_distlist = conn(_subdir)
f_stream = New StreamReader(filename, System.Text.Encoding.Default)
orgfile = filename.Substring(filename.LastIndexOf("\"))
mqMsg.ApplicationIdData = orgfile
msg = f_stream.ReadToEnd
f_stream.Close()
'mqMsg.MessageData = msg
mqMsg.WriteString(msg)
mqMsg.Format = MQFMT_STRING
mqMsg.Version = MQMD_VERSION_2
mqMsg.MessageFlags = MQMF_SEGMENTATION_ALLOWED
po.Options = MQPMO_SET_ALL_CONTEXT
po.Version = MQPMO_VERSION_2
_distlist.OpenOptions = MQOO_OUTPUT + MQOO_SET_ALL_CONTEXT + MQOO_FAIL_IF_QUIESCING
_distlist.Open()
_distlist.Put(mqMsg, po)
MessageBox.Show("File put to queue Successful!!!")
If file.Exists(_subdir.Backup & orgfile) = False Then
file.Move(_subdir.Moniter_Path & orgfile, _subdir.Backup & orgfile)
Else
file.Delete(_subdir.Backup & orgfile)
file.Move(_subdir.Moniter_Path & orgfile, _subdir.Backup & orgfile)
End If
MessageBox.Show("Back up Successful!!!")
Catch ex As Exception
If _distlist.CompletionCode = 2 Then
If _distlist.ReasonCode = 2059 Or 2009 Then
MessageBox.Show(_distlist.ReasonCode & " " & _distlist.ReasonName)
Throw New System.Exception(_distlist.ReasonCode)
Else
Throw New System.Exception(_distlist.ReasonName)
End If
Else
Throw ex
End If
Finally
mqQmgr.Disconnect()
End Try
End Sub
It was return Null Pointer and have some it's cannot open this command _distlist.Open() So I'd like to know we can use IBM.WMQ.Message,MQPutMessageOptions work with MQAX200 or can't.
and if it can't work together Have anyway to use segmental Msg with Distribution list |
|
Back to top |
|
 |
AmOnion |
Posted: Mon Oct 23, 2006 8:02 pm Post subject: |
|
|
Newbie
Joined: 17 Oct 2006 Posts: 7
|
Or Have any sample code for put segment Message to Distribution list please help me too... thanks for your kindness |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Oct 24, 2006 2:38 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Don't you think you might need to set all those flags BEFORE you start to write to the message?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
AmOnion |
Posted: Tue Oct 24, 2006 6:02 pm Post subject: |
|
|
Newbie
Joined: 17 Oct 2006 Posts: 7
|
Actually,I think it's set of MQMD so It hasn't affect for process because it's not still put to the queue so I can set after write message  |
|
Back to top |
|
 |
tleichen |
Posted: Wed Oct 25, 2006 9:08 pm Post subject: |
|
|
Yatiri
Joined: 11 Apr 2005 Posts: 663 Location: Center of the USA
|
AmOnion wrote: |
Actually,I think it's set of MQMD so It hasn't affect for process because it's not still put to the queue so I can set after write message  |
Huh?  _________________ IBM Certified MQSeries Specialist
IBM Certified MQSeries Developer |
|
Back to top |
|
 |
AmOnion |
Posted: Wed Nov 01, 2006 11:09 pm Post subject: |
|
|
Newbie
Joined: 17 Oct 2006 Posts: 7
|
I sent normal message with the first code it can put message successful but when I insert about segmental message on MQMD it can not sent so if anyone know about this please help me thanks  |
|
Back to top |
|
 |
Vitor |
Posted: Thu Nov 02, 2006 1:01 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
It can not be sent why? You get a reason code? The machine powers down? The pixies steal it?
(And if it is the pixies, tell them I want my notificiation messages back, but that's another story and not relevant to your problem )
If you provide some information we stand a much better chance of providing some help! Does the segmented message fail on first put, 2nd put, nth put what? With what code? Is there no code but it's not delivered? Exactly what flags are you setting on what put?
Most importantly, what have you already tried to resolve this problem? There's no point us suggesting things you have already tried. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
AmOnion |
Posted: Thu Nov 02, 2006 5:57 pm Post subject: |
|
|
Newbie
Joined: 17 Oct 2006 Posts: 7
|
I set :
mqMsg.MessageData = msg
po.Options = MQPMO_SET_ALL_CONTEXT
_distlist.OpenOptions = MQOO_OUTPUT + MQOO_SET_ALL_CONTEXT + MQOO_FAIL_IF_QUIESCING
_distlist.Open()
_distlist.Put(mqMsg, po)
(use MQAX200.MQMessage and MQAX200.MQPutMessageOptions)
Follow that: it can put normal message complete!!! but follow this:
mqMsg.WriteString(msg)
mqMsg.Format = MQFMT_STRING
mqMsg.Version = MQMD_VERSION_2
mqMsg.MessageFlags = MQMF_SEGMENTATION_ALLOWED
po.Options = MQPMO_SET_ALL_CONTEXT
po.Version = MQPMO_VERSION_2
_distlist.OpenOptions = MQOO_OUTPUT + MQOO_SET_ALL_CONTEXT + MQOO_FAIL_IF_QUIESCING
_distlist.Open()
_distlist.Put(mqMsg, po)
(use IBM.WMQ.MQMessage and IBM.WMQ.MQPutMessageOptions because
MQAX200 have not segmental Message)
It cannot put because can't open distributionlist queue
Maybe can't use IBM.WMQ.MQMessage and IBM.WMQ.MQPutMessageOptions with MQAX200
so if anyone know about this please help me thanks  |
|
Back to top |
|
 |
|