Author |
Message
|
akinomd |
Posted: Mon Feb 24, 2003 5:53 am Post subject: Channel send exit |
|
|
Newbie
Joined: 24 Feb 2003 Posts: 2
|
I would like to write a send exit in Java.
I defined a class (MySendExit) that implements the MQSendExit interface. Then in the other class (MyTest) I created a new instance of the class MySendExit, assigned the MQEnvironment.sendExit variable to it and constructed my MQQueueManager object...
Both classes I have in the same directory, which I included in my classpath.
The problem is that I do not know how to set the SENDEXIT and SENDDATA parameters in the channel. I tried to specify the channel send exit name as "java my.package.MyTest", but it unfortunately does not work... No matter how I configure that parameter, my channel does not want to start and its status is continuously 'retrying'. Could anyone help me?
Thanks for any replies,
akinomd |
|
Back to top |
|
 |
emiranda |
Posted: Fri Mar 14, 2003 11:30 am Post subject: |
|
|
 Disciple
Joined: 21 Nov 2002 Posts: 196 Location: Dublin, Ireland
|
Hi.
Java is only supported in client side. Otherwise you have to use C/C++.
rgds, _________________ Warm Regards,
EM |
|
Back to top |
|
 |
akinomd |
Posted: Wed Mar 19, 2003 12:03 am Post subject: |
|
|
Newbie
Joined: 24 Feb 2003 Posts: 2
|
Hi Eduardo,
Thanks for the reply. I have already found out that I can only write client code in Java. Anyway, I would be very grateful to you for any information on setting the SENDEXIT parameter in the channel (for Java programs). If you could help me, let me know, please.
Regards,
akinomd |
|
Back to top |
|
 |
rajmq |
Posted: Sat Mar 29, 2003 11:01 pm Post subject: |
|
|
 Partisan
Joined: 29 Sep 2002 Posts: 331 Location: USA
|
Hi emiranda
Can u explain How can i achive Client to Server Channel Exits Using the
Java.
can u give some links or sample programs.
thanks
raj |
|
Back to top |
|
 |
emiranda |
Posted: Mon Mar 31, 2003 5:18 am Post subject: |
|
|
 Disciple
Joined: 21 Nov 2002 Posts: 196 Location: Dublin, Ireland
|
Hi guys,
Unfortunately I don't have any sample exit in Java code written by myself, but I got something in my files (probably another discussion/newsgroup).
You have to implement the interfaces MQSecurityExit, MQSendExit and MQReceiveExit.
The pseudocode for Java exits:
MyExit.java
------------
public MyExit implements
MQSecurityExit, MQSendExit, MQReceiveExit {
public byte[] securityExit ( .... ) {
// Implement function here.
}
public byte[] sendExit ( .... ) {
// Implement function here.
}
public byte[] receiveExit ( .... ) {
// Implement function here.
}
}
Client.java
------------
public class Client {
public static void main (String args[])
{
MQEnvironment.securityExit =
MQEnvironment.sendExit =
MQEnvironment.receiveExit = new MyExit();
// Create QMGR connection here etc...
}
}
Here all the interfaces are implemented in only one class. You can implement them in different classes files also.
Hope it helps
rgds, _________________ Warm Regards,
EM |
|
Back to top |
|
 |
rajmq |
Posted: Tue Apr 01, 2003 9:57 pm Post subject: |
|
|
 Partisan
Joined: 29 Sep 2002 Posts: 331 Location: USA
|
Hi emiranda
Thanks for ur Reply.
public byte[] sendExit ( .... ) {
// Implement function here.
}
But the problem is what function implementation i need write,can u give any example or that discussion link...
regards
raj |
|
Back to top |
|
 |
Torsten |
Posted: Thu Jul 20, 2006 7:21 am Post subject: MQSendExit samples |
|
|
Newbie
Joined: 20 Jul 2006 Posts: 7 Location: Denmark
|
Hi
I've a problem in locating my user msg in the byte[] parameter to the SendExit method.
I've found (by experiments) that my SendExit method is invoked 5 or 6 times upon a put to a queue (!!), but only one of the invokations contains my user msg - starting at location 512 (or something like that).
I've also found that the 4 bytes before pos 512, contains the length of my user msg.
So far so good, but this is a kind of "hacking" and I've searched the net in vain (inclunding IBM's MQ docs) for specification of the byte[] layout.
The only thing, I've found is some C structs - but that does'nt help very much.
Anyone with experience in this ??
Take care
Torsten |
|
Back to top |
|
 |
Nigelg |
Posted: Mon Jul 24, 2006 1:13 am Post subject: |
|
|
Grand Master
Joined: 02 Aug 2004 Posts: 1046
|
The layout of the data in the channel flows is not published by IBM, so you have to hack it, as you put it, if you want to find your data. _________________ MQSeries.net helps those who help themselves.. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jul 24, 2006 1:19 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Also, if you want the whole message, you can use a message exit instead of a send/receive exit. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Torsten |
Posted: Mon Jul 24, 2006 1:23 am Post subject: |
|
|
Newbie
Joined: 20 Jul 2006 Posts: 7 Location: Denmark
|
Hi
thanks both for your replies, but a message exit can't be written in Java ???
Take care
Torsten |
|
Back to top |
|
 |
Nigelg |
Posted: Mon Jul 24, 2006 1:29 am Post subject: |
|
|
Grand Master
Joined: 02 Aug 2004 Posts: 1046
|
In that case write the exit in a programming language that is supported, i.e. C. _________________ MQSeries.net helps those who help themselves.. |
|
Back to top |
|
 |
markt |
Posted: Mon Jul 24, 2006 6:01 am Post subject: |
|
|
 Knight
Joined: 14 May 2002 Posts: 508
|
A channel exit written in Java can only be used in Java programs.
The only Java MQ programs are clients (or locally bound).
The only channel exits for any client are security and send/receive.
Therefore you cannot write a channel message exit in Java.
The contents of the send/receive buffers are not externally documented, other than byte 10 which tells you which MQI verb is being executed.
You cannot rely on the layout of the send/receive buffer - it can and will
change. And if the channel has compression enabled, that happens above
the send/receive exits so you would not see plaintext anyway. |
|
Back to top |
|
 |
Torsten |
Posted: Mon Jul 24, 2006 6:10 am Post subject: |
|
|
Newbie
Joined: 20 Jul 2006 Posts: 7 Location: Denmark
|
thank you markt
we are using jms and core mq API for Java, so the MQSendExit and MQReceiveExit seemed to be logical choices.
Your remark about compression worries me, because we are later going to use 2-way SSL - so then I won't get plain text either ??? (in exits).
If that's the case, I might just provide the MDB developers with a POJO, capable of making the required data modifications required during test-phases.
They can then invoke my POJO just prior to sending and just after receiving MQ messagers
thanks to all
Torsten |
|
Back to top |
|
 |
markt |
Posted: Mon Jul 24, 2006 6:40 am Post subject: |
|
|
 Knight
Joined: 14 May 2002 Posts: 508
|
encryption in SSL happens AFTER the send exit so a send exit would see
compressed, but not encrypted headers and data, assuming you turn on both SSL and compression. |
|
Back to top |
|
 |
Torsten |
Posted: Tue Jul 25, 2006 12:30 am Post subject: |
|
|
Newbie
Joined: 20 Jul 2006 Posts: 7 Location: Denmark
|
Hi markt
OK, since we not are going to use compression, I'll continue to use the exits.
Thanks for the help
Torsten |
|
Back to top |
|
 |
|