|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Putting files in queues.... |
« View previous topic :: View next topic » |
Author |
Message
|
jed |
Posted: Mon Feb 16, 2004 2:36 am Post subject: Putting files in queues.... |
|
|
 Centurion
Joined: 08 Jan 2004 Posts: 118 Location: MI, USA
|
We're using VB 6.0 for our mq application development.
I'm able to program putting messages into the queue.
My question is, how do I put file(s) into the queue?
I understand that I can put message(s) into the queues, but how to do that if i need to use files as my message? _________________ Jed |
|
Back to top |
|
 |
Michael Dag |
Posted: Mon Feb 16, 2004 4:27 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
Moved to General Discussion |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Feb 16, 2004 4:40 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
A message is a stream of bytes.
A file is a stream of bytes.
Read the file into memory, and put it into a message.
Or read up on reference messages. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
jed |
Posted: Mon Feb 16, 2004 8:13 pm Post subject: |
|
|
 Centurion
Joined: 08 Jan 2004 Posts: 118 Location: MI, USA
|
JeffLowrey wrote: |
A message is a stream of bytes.
A file is a stream of bytes.
Read the file into memory, and put it into a message.
Or read up on reference messages. |
Thanks for the input....
But, how to do that?
I'm using VB6.0 and the following are my codes....
Private Sub cmdPut_Click()
Dim md As MQMD
Dim pmo As MQPMO
Dim buflen As Long
Dim Buffer As String
Dim CompCode As Long
Dim Reason As Long
Dim RetVal As Integer
Dim FileHandle As Integer
Dim FileStream As String
Dim RecordOffset As Long
Dim MqMsg As MQMessage
Dim QueueName As MQQueue
MQMD_DEFAULTS md
md.Format = MQFMT_STRING
MQPMO_DEFAULTS pmo
If txtPut.Text <> "" Then
buflen = Len(txtPut.Text)
Buffer = txtPut.Text
Else
MQMD_DEFAULTS md
FileHandle = FreeFile
Open File1.FileName For Binary As FileHandle
FileStream = Input(LOF(FileHandle), FileHandle)
MsgBox (FileStream)
Close FileHandle
buflen = Len(FileStream)
Buffer = FileStream
End If
MQPUT gHcon, gHobj, md, pmo, buflen, Buffer, CompCode, Reason
If CompCode = MQCC_FAILED Then
RetVal = MsgBox("Put Failed! Reason code is " + Str(Reason), vbOKOnly)
txtPut.SetFocus
Else
txtPut.Text = ""
txtPut.SetFocus
End If
End Sub
On the reading of the file.... I can only declare a string and it cannot handle large files. Any clue on how to change this one? _________________ Jed |
|
Back to top |
|
 |
jed |
Posted: Tue Feb 17, 2004 6:06 pm Post subject: Java program works..... |
|
|
 Centurion
Joined: 08 Jan 2004 Posts: 118 Location: MI, USA
|
With all the struggling, I shifted/changed and made a program in Java just to test the program (with assistance from my java guru colleague).
And, I was able to put 6MB, 8MB files into the queue.
Anyone out there know of any VB guru?
'Coz, seems like VB doesn't have the filestream capability of Java.
Although, I've read in passing that VB.NET has filestream capability.
Still, since VB is one of the programming languages use to program MQ stuffs. It should be able to do that (as shown on my previous post, only lacking the reading of big files). _________________ Jed |
|
Back to top |
|
 |
jed |
Posted: Thu Feb 19, 2004 12:28 am Post subject: Made a C program for reading files and put into the queue. |
|
|
 Centurion
Joined: 08 Jan 2004 Posts: 118 Location: MI, USA
|
Now I got it using C (not VC++, I'm not that familiar with that one).
Just for fyi only. _________________ Jed |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|