473,378 Members | 1,594 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,378 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 1456

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
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.