I am new to IBM MQ and I have followed the steps mentioned in JMETER IBM MQ Testingand successfully connected to the IBM MQ. In this link, I could see the string mentioned in the line
def payload = String.format("JMeter...IBM MQ...test message no. %09d!", rnd.nextInt(Integer.MAX_VALUE))
is reflecting the IBM MQ.
Now, my question here is, how to send the content/xml file to the IBM MQ.
Fetching the file using the below code in JSR223 Sampler,
import org.apache.jmeter.util.JMeterUtils;
String fileContents = new File('./test.xml').getText('UTF-8');
vars.put("content",fileContents);
Code snippet used in JSR223 Sampler to send the xml,
def payload = vars.get("content");
def msg = sess.createTextMessage(payload)})
def start = Instant.now()
producer.send(msg)
By doing this, Response message:javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script4.groovy: 15: Unexpected input: '"' # line 15, column 34.
def payload = " is observed.
Kindly help me how can I achieve sending xml to IBM MQ using JMETER.
Looks like a typo:
def msg = sess.createTextMessage(payload)})
^here
just change it to
def msg = sess.createTextMessage(payload)
and it should start working as expected.
Just in case:
IBM MQ testing with JMeter - Learn How
Write and run your first IBM MQ JMS application
Related
I'm very new to IBM MQ and feel like I'm missing something fairly easy.
I received the following files and I'm attempting to connect to an externally hosted MQ:
.crl
.kdb
.rdb
.sth
.tab
I've tried several different approaches, but the "furthest" I think I've gotten is:
MQRC_CONNECTION_BROKEN Reason: 2009 when I attempt to create a new Queue Manager connection.
Below is my most recent block of code, trying to get this to work:
using IBM.WMQ;
...
Hashtable connectionProperties = new Hashtable();
connectionProperties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);
connectionProperties.Add(MQC.HOST_NAME_PROPERTY, SOME_ADDRESS);
connectionProperties.Add(MQC.CHANNEL_PROPERTY, SOME_CHANNEL);
connectionProperties.Add(MQC.PORT_PROPERTY, SOME_PORT);
connectionProperties.Add(MQC.SSL_CERT_STORE_PROPERTY, PATH TO KDB FILE without .kdb);
connectionProperties.Add(MQC.SSL_CIPHER_SUITE_PROPERTY, SOME_CIPHER);
MQQueueManager qmgr = new MQQueueManager(SOME_VALUE, connectionProperties);
Prior to this I was attempting to set the MQ_CHANNEL_LIB and MQ_CHANNEL_TAB environment variables and call MQQueueManager qmgre = MQQueueManager() but that resulted in a 2277 error code.
I'm currently using the IBMMQDotnetClient/9.3.0 nuget package. Any help would be greatly appreciated.
The *.kdb file is a ssl keystore file containing certificates required to connect to queue manager. The *.kdb file can only be used with Transport type (TRANSPORT_PROPERTY property) MQC.TRANSPORT_MQSERIES_CLIENT. In this mode, MQ .NET client uses MQI C client underneath to communicate with queue manager.
The *.tab file is a client channel definition table (CCDT) file containing connection information like qm name, channel name, host name and few others required to connect to your queue manager.
Since you are using IBMMQDotnetClient/9.3.0 nuget package, TRANSPORT_MQSERIES_CLIENT transport type can't be used as the package doesn't contain MQI C client. With this nuget package you can only use TRANSPORT_MQSERIES_MANAGED. Ask your admins/management if they can provide you Redistributable MQ client. This package contains MQI C, .NET and other MQ clients libraries. You can choose to install the client libraries you want to use.
As Shashi mentioned if you need to use the Unmanaged mode,you need MQ C Client libraries as well.
You need to reference "amqmdnet.dll" which comes with IBM MQ Redistributable package to your .NET project. You can download IBM MQ Redistributable package from IBM Fix central.
To use CCDT, you need to set MQCHLLIB & MQCHLTAB environment variables.On how to create a CCDT file you can refer KC page:Configuring a binary format CCDT
After creating the CCDT File, i had used only the following code in my project to establish a successful connection
Environment.SetEnvironmentVariable("MQCHLLIB", #"C:\ProgramData\IBM\MQ\qmgrs\QMSSL\#ipcc");
Environment.SetEnvironmentVariable("MQCHLTAB", "AMQCLCHL.TAB");
Hashtable properties = new Hashtable();
properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT);
Environment.SetEnvironmentVariable("MQSSLKEYR", #"C:\temp\Certs\ForCclient\client");
try
{
queueManager = new MQQueueManager(queueManagerName, properties);
}
catch (MQException e)
{
Console.WriteLine("ERROR - Connect failed with unexpected MQRC {0}", e.ReasonCode);
throw e;
}
I have xml messages and want to send them to an MSFT ASB queue.
Is it doable with JMeter JMS Point-To-Point?
If yes How?
Cannot figure out how to configure.
All I have is a connection String to the ASB.
Thanks in advance.
Feedback 1:
INFO o.a.q.j.s.SaslMechanismFinder: Best match for SASL auth was: SASL-ANONYMOUS
2018-10-02 18:46:19,734 INFO o.a.q.j.JmsConnection: Connection ID::8356a2a7-4cf2-4ab0-8ee9-240b62f5fd73:1 connected to remote Broker: amqps://<HOSTNAME>.servicebus.windows.net
2018-10-02 18:46:20,321 WARN o.a.q.j.p.a.b.AmqpResourceBuilder: Open of resource:(JmsProducerInfo { ID::8356a2a7-4cf2-4ab0-8ee9-240b62f5fd73:1:1:1, destination = <QUEUENAME> }) failed: Unauthorized access. 'Send' claim(s) are required to perform this operation. Resource: 'sb://<HOSTNAME>.servicebus.windows.net/<QUEUENAME>'. TrackingId:79fda5972c644c8d8f1c33bea40987ae_G52, SystemTracker:gateway7, Timestamp:10/2/2018 3:46:17 PM [condition = amqp:unauthorized-access]
2018-10-02 18:46:20,321 ERROR o.a.j.p.j.s.JMSSampler: Unauthorized access. 'Send' claim(s) are required to perform this operation. Resource: 'sb://<HOSTNAME>.servicebus.windows.net/<QUEUENAME>'. TrackingId:79fda5972c644c8d8f1c33bea40987ae_G52, SystemTracker:gateway7, Timestamp:10/2/2018 3:46:17 PM [condition = amqp:unauthorized-access]
javax.jms.JMSSecurityException: Unauthorized access. 'Send' claim(s) are required to perform this operation. Resource: 'sb://<HOSTNAME>.servicebus.windows.net/<QUEUENAME>'. TrackingId:79fda5972c644c8d8f1c33bea40987ae_G52, SystemTracker:gateway7, Timestamp:10/2/2018 3:46:17 PM [condition = amqp:unauthorized-access]
Yes it should be possible through AMQP JMS Client library
Steps:
Add those 2 jars to jmeter/lib folder
geronimo-jms_1.1_spec-1.0.jar
qpid-jms-client-[version].jar
Create a properties file called servicebus.properties:
# servicebus.properties - sample JNDI configuration
# Register a ConnectionFactory in JNDI using the form:
# connectionfactory.[jndi_name] = [ConnectionURL]
connectionfactory.SBCF = amqps://[SASPolicyName]:[SASPolicyKey]#[namespace].servicebus.windows.net
# Register some queues in JNDI using the form
# queue.[jndi_name] = [physical_name]
# topic.[jndi_name] = [physical_name]
queue.QUEUE = queue1
Configure JMS Point-to-Point this way (change host):
See this for more details:
https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-java-how-to-use-jms-api-amqp
I could achive sending message to azure service bus by using the "AMQP Publisher-Sampler" or "Java Sampler". The difference to JMS Point-to-point Sampler is that both use "SEND claims" resp. "LISTEN claims", when sending a message, and that is not part of JMS Point to Point standard implementation.
I am running Weblogic 10.3 on Linux and I have setup a bridge to Webspere MQ. I am sending a TextMesasge from Weblogic and it is being transfered to MQ. But when I am reading the message on MQ side like
// Receiver reader - my class
reader.qMgr = new MQQueueManager(qManager);
int openOptions = MQOO_INPUT_AS_Q_DEF | MQOO_OUTPUT ;
MQQueue localQueue = reader.qMgr.accessQueue(queueName, openOptions);
MQMessage msg = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions();
localQueue.get(msg, gmo);
int n = msg.getDataLength();
System.out.println("The message is " + n + " bytes long");
String msgText = msg.readStringOfByteLength(n);
System.out.println("The message is: " + msgText);
I am getting:
The message is 154 bytes long
The message is: RFH ��MQSTR � jms_text Hqueue:///Q113575850399442 ABCDE
"ABCDE" is my message.
Do I have somehow to instruct Websphere MQ to perform JMS->MQ conversion so the message will be read as simple 'ABCDE'?
Thanks
The program sending the messages should set the TARGCLIENT parm as described here.
Please bear in mind that all WMQ V6.x is out of support. If you were to use one of the supported versions (all the v7.x) you would be able to set the queue's PROPCTL attribute to cause the QMgr to strip the JMS headers without little or no code changes.
You can get the new version of WMQ through Passport Advantage if your company has a support agreement in place. The new client is available at no charge as SupportPac MQC75. You can mix client and QMgr versions and the new clients have a number of bug fixes and new features (many of which you can use even while connecting to an older QMgr). The newer client and QMgr will also have security patches not present on the V6 code. Please try to get to a supported version at least of the client since its free but preferably of the QMgr as well.
If you use the supported JMS API on the WebSphere MQ side, you don't have to perform any conversion to obtain the content of the message.
You can just invoke the javax.jms.TextMessage.getText() method that will return the content of the message (ABCDE).
I trying create one topic publisher with TIBCO Designer using a ActiveDatabase Adapter.
But every time when the adapter starts one topic named _ADB.DUPDETECT is created too
The problem is: my EMS server don´t allow dynamic topics. Then I get following error:
2010 Aug 23 10:38:20:825 GMT -3 M2M.M2M Error [Adapter] AEADB-910005
Startup Error. SDK Exception Code = AESDKC-0151, Category = JmsComm, Severity = errorRole, Description = JMS Error: Failed to create Jms Subscriber DupDetectMessage : Invalid destination, File = C:/suren/workspace/Maverick/maverick-5.6.1-dev/libmaverick/MJmsConsumer.cpp, line = 271 received on starting the adapter after initialization. The Repository URL is D:\Temp\Lixo\AT_adadb_9991.dat and the Configuration URL is M2M.
Unfortunately couldn´t find any information about this error in Google or in TIBCOmmunity.
Anybody can help me with this?
Thanks advance.
You'll need to create the _ADB.DUPDETECT topic in EMS before you start the adapter. e.g., from within tibemsadmin
create topic _ADB.DUPDETECT
To allow your TIBCO EMS Server the creation of dynamic topics you need to create one like this by using the EMS Administration Tool:
connect tcp://localhost:7222
Login name (admin): admin
Password:
Connected to: tcp://localhost.7222
tcp://localhost:7222> create topic >
Topic '>' has been created
You can do this via TIBCO Administrator too:
I trying create one publisher with TIBCO Designer using a ActiveDatabase Adapter.
But every time when the adapter starts one topic named _ADB.DUPDETECT is created too
The problem is: my EMS server don´t allow dynamic topics. So i get following error:
2010 Aug 23 10:38:20:825 GMT -3 M2M.M2M Error [Adapter] AEADB-910005
Startup Error. SDK Exception Code = AESDKC-0151, Category = JmsComm, Severity = errorRole,
Description = JMS Error:
Failed to create Jms Subscriber DupDetectMessage : Invalid destination, File =
C:/suren/workspace/Maverick/maverick-5.6.1-dev/libmaverick/MJmsConsumer.cpp,
line = 271 received on starting the adapter after initialization. The Repository URL is
D:\Temp\Lixo\AT_adadb_9991.dat and the Configuration URL is M2M.
Unfortunately couldn´t find any information about this error in Google or in TIBCOmmunity.
Anybody can help me with this?
Thanks advance.
Is there a reason you can't create a static destination topic:_ADB.DUPDETECT prior to the first start up of the adapter?
To allow your TIBCO EMS Server the creation of dynamic topics you need to create one like this by using the EMS Administration Tool:
connect tcp://localhost:7222
Login name (admin): admin
Password:
Connected to: tcp://localhost.7222
tcp://localhost:7222> create topic >
Topic '>' has been created
You can do this via TIBCO Administrator: