Hi
Need to replace MYMESSAGE with isomsg of iso8583 sampler.
package org.jpos.iso.channel;
import com.ibm.jms.JMSTextMessage;
import com.ibm.mq.jms.*;
import com.ibm.msg.client.wmq.WMQConstants;
import org.jpos.iso.ISOChannel;
import org.jpos.iso.ISOException;
import org.jpos.iso.ISOMsg;
import org.jpos.iso.BaseChannel;
import org.jpos.core.Configuration;
import org.jpos.core.Configurable;
import org.jpos.core.ConfigurationException;
import javax.jms.*;
public class JMSChannel extends BaseChannel implements ISOChannel, Configurable {
   private MQQueueConnectionFactory cf;
   private MQQueueConnection connection;
   private MQQueueSession session;
   private MQQueueSender sender;
   public void setConfiguration(Configuration cfg) throws ConfigurationException {
     try {
       cf = new MQQueueConnectionFactory();
       cf.setHostName(cfg.get("host"));
       cf.setPort(cfg.getInt("port"));Â
       cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);
       cf.setQueueManager(cfg.get("queueManager"));
       cf.setChannel(cfg.get("channel"));
       cf.setStringProperty(WMQConstants.USERID, cfg.get("user"));
       cf.setStringProperty(WMQConstants.PASSWORD, cfg.get("pass"));
       connection = (MQQueueConnection) cf.createQueueConnection();
       session = (MQQueueSession) connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
       MQQueue queue = (MQQueue) session.createQueue(cfg.get("qname"));
       sender = (MQQueueSender) session.createSender(queue);
       JMSTextMessage message = (JMSTextMessage) session.createTextMessage("MYMESSAGE");
Â
       connection.start();
       sender.send(message);                Â
                            Â
     } catch (JMSException e) {
       throw new ConfigurationException(e);
     }
   }     Â
}
That doesn’t seem to be the place to do that.
It is in the send method that you get the message to send to the queue.
There you just would use the packager to pack the message and send it to the queue, but it should be a binary message, not a text one. And it seems you are already doing that, according to another message you posted on the list:
public void send(ISOMsg isoMsg) throws ISOException {
try {
// Convert ISO8583 message to JMS message
BytesMessage jmsMsg = session.createBytesMessage();
jmsMsg.writeBytes(isoMsg.getBytes());
// Send JMS message to the queue
sender.send(jmsMsg);
} catch (JMSException e) {
throw new ISOException("Error sending JMS message", e);
}
}
So, why are you now trying to send a message in configuration time?
Andrés Alcarraz
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/7933225a-d6af-4674-b3fd-63362f4fc1b9n%40googlegroups.com.
Doesn’t isoMsg.getBytes()
 throw an ISOException ("N/A in Composite");
?
Don’t you need a pack()
?
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/f5c874db-898c-4f20-88e9-d361713d4519%40gmail.com.
Good catch, TBH I didn’t inspect the code, just pasted what the OP posted.
As Alejandro says you
need to use the packager to get the bytes, you can take a look
at how BaseChannel
does that:
m.setDirection(ISOMsg.OUTGOING);
ISOPackager p = getDynamicPackager(m);
m.setPackager (p);
m = applyOutgoingFilters (m, evt);
evt.addMessage (m);
m.setDirection(ISOMsg.OUTGOING); // filter may have dropped this info
m.setPackager (p); // and could have dropped packager as well
byte[] b = pack(m);
You can omit the filter part, I don’t think you need to implement filters for your use case.
Also, I don’t think
extending BaseChannel
is a good idea, since it is mainly for raw TCP/IP based
connections.
Andrés Alcarraz
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3D%3DuSztR5h3tcFCTGb1jBfSb-tq63ZACzvzCk3ZrQDYY5A%40mail.gmail.com.
Would you please write complete code that you mean?
There will be an error output somewhere. Perhaps debug and step through? Glad you are trying things. You arenworkingnfor a company? See if they have anyone that can help you? -- Mark --Â Mark
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/a51e2b5a-6828-4c82-9f4b-d78ccb17a7dfn%40googlegroups.com.
Hi Mehrdad,
BaseChannel
linked below as an example of how to write your channelSo the answer under these circumstances is no, but I, and the rest of the community here, can try to help you try to sort out any obstacle you find while you try to do it yourself. On the plus side, you’ll learn a lot in the process.
In another message, I mentioned that if you are using jPOS only for this, you may not want to learn all you would need. In that case, I would consider hiring someone that develops this for you, or try to find out another tool for the tests you want to perform.
Andrés Alcarraz
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/274e6841-3b5f-4358-bd65-aca813b0302an%40googlegroups.com.
For you to look at and debug rather than me. I would address those "cannot be null" warnings, but you don't need an up target, so perhaps still caretaking too much BaseChannel. Debug and step throughbyourbcodebas I suggested, that should give the most information on what is failing and why. --Â Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/4a194e70-bc8d-42f3-a20e-6c717169f79an%40googlegroups.com.
2024-04-05 16:38:13,540 DEBUG n.c.b.j.i.ISO8583Config: Deploying <channel-adaptor name="jmeter-90b931b7-channel" logger="Q2"><in>jmeter-90b931b7-send</in><out>jmeter-90b931b7-receive</out><reconnect-delay>10000</reconnect-delay><wait-for-workers-on-stop>yes</wait-for-workers-on-stop><channel name="jmeter-90b931b7" class="org.jpos.iso.channel.JMSChannel" packager="org.jpos.iso.packager.GenericPackager" header="0000" logger="Q2"><property name="packager-config" value="/opt/apache-jmeter-5.6.2/configs/packager/iso2003ascii_NEW.xml" /><property name="host" value="192.168.1.10" /><property name="port" value="9000" /><property name="channel" value="mychannel" /><property name="queueManager" value="myqmanager" /><property name="user" value="myuser" /><property name="pass" value="mypass" /><property name="qname" value="queue:///APP.foo.bar" /></channel></channel-adaptor>
2024-04-05 16:38:13,588 DEBUG n.c.b.j.i.ISO8583Config: Deploying <qmux name="jmeter-90b931b7-mux" logger="Q2"><in>jmeter-90b931b7-receive</in><out>jmeter-90b931b7-send</out><unhandled>jmeter-90b931b7-unhandled</unhandled><ready>jmeter-90b931b7.ready</ready></qmux>
2024-04-05 16:38:13,589 WARN n.c.b.j.i.Q2: (org.jpos.q2.iso.ChannelAdaptor) channel-sender-jmeter-90b931b7-send
2024-04-05 16:38:13,589 WARN n.c.b.j.i.Q2: (org.jpos.q2.iso.ChannelAdaptor) hostname can't be null
Yeah, I am sure your setup is perfect and the code is somehow ignoring it. Please take my guidance and debug your code for your problem. We can't help you remotely and you have access tonall you need, if you would try. I will now start ignoring you until you stop choosing to ignore me and my advise. Have fun! -- Mark --Â Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/7be7027c-1a76-49cc-987d-35abbaf76363n%40googlegroups.com.
Hi Mehrdad, please don’t share logs as image. Share the text and in preformatted text please, same for the code, it makes it easier to read.
Also, one thing you should know, most of us are not experts on jmeter, just plain jPOS. Therefore, before you try to make your class work in jMeter, it would be a good advice to start a jPOS project from scratch. It makes it even harder for us to help you, trying to guess what jMeter could or not be doing.
So, you can go through the first and probably second jPOS tutorials to start a jPOS project and then modify the channel to use yours. It would be easier to debug that, and check if it connects to the queue, and the messages are being sent.
I’m sorry to tell you that if you want to go the jMeter/jPOS route you will need to understand jPOS and java deeper, that’s not optional. If that is not part of your job description, and you’re not willing to do it, then you should advise your employer that they need to hire someone else for that task. We can guide you, but we cannot do the things for you.
Best regards.
Andrés Alcarraz
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/863f5a65-fe43-45c9-97a9-b9b2e1175d24n%40googlegroups.com.