|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MQJava Channel Exit Good Practices Urgent ??????? |
« View previous topic :: View next topic » |
Author |
Message
|
abiram8 |
Posted: Mon Nov 25, 2002 7:22 am Post subject: MQJava Channel Exit Good Practices Urgent ??????? |
|
|
 Master
Joined: 27 Mar 2002 Posts: 207 Location: India
|
Hi all ,
Since our Client Architecture is purely in the J2ee & they are not intrested in c or c++
Our requirment is purely Server To Server (MQServer) Communication
using User Exit
Few things Iam not Clear about writing the Channel Exit Program with MQJava
1) If Channel exit is written Where to save the Exit Programme (I mean the path)
2) Which Attribute of Channel & Queue Manager to be configure with this
Exit Programme
3) If so I need to metion a ".class" file to my attribute or the ".java" File
to the mqsc attribute of the Channel & QueueManager.
If so please let me know the mqsc syntax to configure my channel & QueueManager Attribute
This are the areas where the IBM Redbooks are even lagging dosent give clear picture when it comes to MqJava for writing Exits
Looking for the Reply
Thanks
R.Abiram |
|
Back to top |
|
 |
abiram8 |
Posted: Mon Nov 25, 2002 8:52 pm Post subject: |
|
|
 Master
Joined: 27 Mar 2002 Posts: 207 Location: India
|
Hi,
I think this post will give you more clear idea about the problem
MQ Server 5.2 in Windows NT
Our requirment is purely Server To Server (MQServer) Communication using Channel Exit Most of the Redbooks gives the Good idea in writing the exit prog in C/C++
Few thingswhich IBM Redbook donot give any idea when it comes to MQJava :
1) If User exit is written Where to save the Exit Programme (I mean the path)
2) Which Attribute (mqsc command) of Channel & Queue Manager to be configure with this Exit Programme
2 a) I mean to define a sender channel for the channel Exit (written in C/C++ programme ) as given in the pdf ("MQSeries Security:
Example of Using a Channel Security Exit, Encryption and Decryption" ) in page number 39
def channel(WT05219A.TC.WT05219B) chltype(SDR)
CONNAME('9.24.104.44(1415)') +
TRPTYPE(tcp) xmitq(WT05219B.TCP.XMITQ) +
SCYEXIT(' MQCHEXIT(ChannelExit)') +
SENDEXIT(' MQCHEXIT(ChannelExit)') +
SCYDATA(' DEBUG' ) replace
but if I have written the Channel Exit programme in say MQJava what would be the syntax for the SCYEXIT & SENDEXIT attributes
2 b) same way the pdf gives the syntax for the receiver Channel as as given in the pdf ("MQSeries Security:
Example of Using a Channel Security Exit, Encryption and Decryption ") in page number 39
def channel(WT05219A.TC.WT05219B) chltype(RCVR) +
SCYEXIT(' MQCHEXIT(ChannelExit)' )
RCVEXIT(, MQCHEXIT(ChannelExit)' )
but if I have written the Channel Exit programme in say MQJava what would be the syntax for the SCYEXIT & RCVEXIT attributes
3 ) If so I need to metion a ".class" file to my mqsc attribute(SCYEXIT ,RCVEXIT,SENDEXIT) or the ".java" File is to be stored in the path
to be mentioned on the attribute (mqsc attribute) of QueueManager & Channel
If so please let me know the mqsc syntax to configure my channel & QueueManager Attribute
This are the areas where the IBM Redbooks are even lagging dosent give clear picture when it comes to
MqJava for writing Exits
Looking for the Quick Reply
Thanks
R.Abiram |
|
Back to top |
|
 |
harwinderr |
Posted: Mon Nov 25, 2002 9:33 pm Post subject: |
|
|
 Voyager
Joined: 29 Jan 2002 Posts: 90
|
Hello Abiram,
From the problem description you have given, it seems that you have a client application in Java and you are interested in knowing how MQJava can be used for implementing exits (send, receive.. ) while talking with the MQ Server. Hope I have got it right
I am giving a code snippet.. this will give you some idea how exits can be called. This sample just calls a simple sendexit.
To provide your own send exit, define a class that implements the MQSendExit interface. Create a new instance of your class and assign the MQEnvironment.sendExit variable to it before constructing your MQQueueManager object. For example:
Code: |
import com.ibm.mq.*;
import java.io.*;
class TestExit {
public static void main(String args[]) {
String msgText = new String("Test Message");
MQEnvironment.hostname = "mahatma.xko.dec.com";
MQEnvironment.port = 1414;
MQEnvironment.channel = "java.channel";
try {
// here we are giving our sendexit (MySendExit)
MQEnvironment.sendExit = new MySendExit();
MQQueueManager qmgr = new MQQueueManager("tempQM");
System.out.println("connected to qm");
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF |
MQC.MQOO_OUTPUT;
MQQueue q = qmgr.accessQueue("myQ",openOptions, null, null, null);
MQMessage hello_world = new MQMessage();
hello_world.format = MQC.MQFMT_STRING;
hello_world.writeUTF(msgText);
MQPutMessageOptions pmo = new MQPutMessageOptions();
q.put(hello_world,pmo);
MQMessage retrievedMessage = new MQMessage();
retrievedMessage.messageId = hello_world.messageId;
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.waitInterval = 100;
gmo.options = MQC.MQGMO_WAIT;
q.get(retrievedMessage, gmo);
String rcvdMsgText = new String(retrievedMessage.readUTF());
System.out.println("message = " + rcvdMsgText);
q.close();
qmgr.disconnect();
}catch (MQException mqex){}
catch (IOException ioex){}
}
} |
Code: |
import com.ibm.mq.*;
class MySendExit implements MQSendExit {
// you must provide an implementation of the sendExit method
public byte[] sendExit(MQChannelExit channelExitParms,
MQChannelDefinition channelDefinition,
byte[] agentBuffer) {
System.out.println("send exit was called!!!");
return agentBuffer;
// your exit code goes here...
}
}
|
Generally the user exit can be anywhere, but you need to include that directory in your classpath.
I am not sure if we have to set the SCYEXIT and SENDEXIT parameters in the channel, because the above sample works fine without that.
Hope this helps you.
Cheers,
Harwinder |
|
Back to top |
|
 |
abiram8 |
Posted: Wed Nov 27, 2002 5:01 am Post subject: |
|
|
 Master
Joined: 27 Mar 2002 Posts: 207 Location: India
|
Hi Harwinder ,
Thanks for the Reply it really helped me to get good solutions
I just want to know one more thing say if Iam sending the message from MqServer To another Mqserver I want all messsages (Which is send to XMitQ to another QM) to be modified according to the send Exit or receive Exit business logic
have you dealt smilar typo earlier please let me know the logic
Thanks
R.Abiram |
|
Back to top |
|
 |
abiram8 |
Posted: Wed Nov 27, 2002 5:03 am Post subject: |
|
|
 Master
Joined: 27 Mar 2002 Posts: 207 Location: India
|
Hi Harwinder ,
Thanks for the Reply it really helped me to get good solutions
I just want to know one more thing say if Iam sending the message from MqServer To another Mqserver I want all messsages (Which is send to XMitQ to another QM) to be modified according to the send Exit or receive Exit business logic
have you dealt smilar typo earlier please let me know the logic
Thanks
R.Abiram |
|
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
|
|
|
|