473,387 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

VB.NET with Webshere MQSERIES

joe
I am looking for VB.NET code to GET a message from the IBM Websphere MQ
Queue. more specifically get an XML message. I have code to PUT a
message:
Public Function GetQueue(ByVal QM As String, ByVal QN As String,
ByVal Channel As String, ByVal Conn As String) As Integer

Dim mqQMgr As MQQueueManager '* MQQueueManager
instance
Dim mqQueue As MQQueue '* MQQueue instance
Dim queueName As String '* Name of queue to use
'*
'* Try to create an MQQueueManager instance
'*
Try
'* queue name, queue manager name provided
mqQMgr = New MQQueueManager(QM, Channel, Conn)
Catch mqe As MQException
'* stop if failed
TextBox1.Text = "Creation of MQQueueManager ended with " &
mqe.Message
Return (mqe.Reason)
End Try

'*
'* Try to open the queue
'*
Try
mqQueue = mqQMgr.AccessQueue(QN, MQC.MQOO_INPUT_AS_Q_DEF +
MQC.MQOO_FAIL_IF_QUIESCING) '* open queue for input but not if MQM
stopping
Catch mqe As MQException
'* stop if failed

Console.WriteLine(String.Format("MQQueueManager::A ccessQueue ended with
{0}", mqe.Message))
Return (mqe.Reason)
End Try

'*
'* Get messages from the message queue
'* Loop until there is a failure
'*
Dim isContinue As Boolean = True
Do While (isContinue = True)
Dim mqMsg As MQMessage '* MQMessage
instance
Dim mqGetMsgOpts As MQGetMessageOptions '*
MQGetMessageOptions instance

mqMsg = New MQMessage
mqGetMsgOpts = New MQGetMessageOptions
mqGetMsgOpts.WaitInterval = 15000 '* 15 second limit for
waiting
Try
mqQueue.Get(mqMsg, mqGetMsgOpts)
If (mqMsg.Format.CompareTo(MQC.MQFMT_STRING) = 0) Then
TextBox1.Text =
mqMsg.ReadString(mqMsg.MessageLength)
Else
TextBox1.Text = "Non-text message"
End If
Catch mqe As MQException
'* report reason, if any
If (mqe.Reason = MQC.MQRC_NO_MSG_AVAILABLE) Then
'* special report for normal end
TextBox1.Text = "no more messages"
isContinue = False
Else
'* general report for other reasons
TextBox1.Text = "MQQueue::Get ended with {0}" &
mqe.Message

'* treat truncated message as a failure for this
sample
If (mqe.Reason = MQC.MQRC_TRUNCATED_MSG_FAILED)
Then
isContinue = False
End If
End If
End Try
Loop

Return (0)

End Function

Nov 22 '05 #1
0 1457

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ardechou | last post by:
Hi , i'm working on unix with MQseries and egate i want to have an injector to use in MQseries. , of course i want to use python to code this. do you some news on ? i want to hve just a sample to...
0
by: driven | last post by:
can some one help me get started with this module, it appears that it very difficult to work with; all I am wanting to do is connect to local QManager and inquire Queue's QDepth. Any help is...
0
by: joe | last post by:
I am looking for VB.NET code to GET a message from the IBM Websphere MQ Queue. more specifically get an XML message. I have code to PUT a message: Public Function GetQueue(ByVal QM As...
6
by: Marvin Libson | last post by:
Hi All: I am running DB2 UDB V7.2 with FP11. Platform is Windows 2000. I have created a java UDF and trigger. When I update my database I get the following error: SQL1224N A database...
0
by: Abram Friesen | last post by:
Hi, I'm running (evaluating) DB2 8.1.6 on AIX 5.2. I just installed MQ AMI, and enabled MQ Functions for DB2. I then set up my own queue (QACF1) via runmqsc. However, trying to send to that...
4
by: Pete H | last post by:
Hi All; I'm trying to get some of the samples that are amply illustrated in multiple docs to work. When I try to create a Warehouse Center view "...for MQ Series messages" or use the UDF wizard in...
0
by: igor73 | last post by:
Hello, I want sure if it is right group to ask this questions but I thought that some of people might have experience programming with mq series. I am writing program using C# libraries. We are...
1
by: Andrew Robert | last post by:
Hi everyone, Has anyone developed a pymqi module based file transfer method for use with WebSphere MQSeries v5.3? If so, would it be possible to point me towards examples of how this was...
9
by: Andrew Robert | last post by:
Hi everyone, I have a python program that will need to interact with an MQSeries trigger monitor. It does this fine but it hogs the trigger monitor while it executes. I'd like to fork the...
4
by: Mark Sullivan | last post by:
Is there somewhere a sample resp. tutorial on how to write and read messages to/from IBM MQseries from C++ programs? Mark
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.