Author |
Message
|
gaorenwei |
Posted: Wed Dec 26, 2018 9:48 pm Post subject: How to use node.js connect to the mq |
|
|
Apprentice
Joined: 16 May 2018 Posts: 29
|
Hi guys. I'm a node.js developer.Is there any way can make node.js connect to the mq? Can you give me a simple deme for that?Many thanks for considering my request. |
|
Back to top |
|
 |
hughson |
Posted: Thu Dec 27, 2018 2:34 am Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
|
Back to top |
|
 |
fernandovch |
Posted: Thu Jan 24, 2019 3:04 pm Post subject: |
|
|
Newbie
Joined: 23 Jan 2019 Posts: 4 Location: Costa Rica
|
Hello,
I'm testing the example the its on the IBM site, but I get this error:
node[6712]: pthread_create: Resource temporarily unavailable
module.js:478
throw err;
^
Error: Cannot find module 'ibmmq'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
The server admin tells me that the IBMMQ it is install.
This is the code:
mq = require('ibmmq'); // import the package containing the MQI library
MQC = mq.MQC; // refer to constant values exported by the package.
mq.Conn("CRI400F", function(err,hConn) {
if (err) {
console.log(err);
} else {
console.log("MQCONN successful ");
// Define what we want to open, and how we want to open it.
od = new mq.MQOD();
od.ObjectName = "CL.LCRBA.SRV.RESPUESTA.SVU";
openOptions = MQC.MQOO_OUTPUT;
mq.Open(hConn,od,openOptions,function(err,hObj) {
if (err) {
console.log(err);
} else {
console.log("MQOPEN successful");
}
});
}
});
msg = "Hello from Node at " + new Date();
mqmd = new mq.MQMD(); // Defaults are fine.
pmo = new mq.MQPMO();
mq.Put(hObj,mqmd,pmo,msg,function(err) {
if (err) {
console.log(err);
} else {
console.log("MQPUT successful");
}
}); |
|
Back to top |
|
 |
hughson |
Posted: Thu Jan 24, 2019 3:20 pm Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
The Node.js package is not part of the IBM MQ install. Read the link I provided before which contains where to find the Node.js package.
Cheers,
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
fernandovch |
Posted: Thu Jan 31, 2019 9:09 am Post subject: |
|
|
Newbie
Joined: 23 Jan 2019 Posts: 4 Location: Costa Rica
|
Hi hughson
he error is not with the Nodejs, If I run this the error is
Error: Cannot find module 'ibmmq'
If in the server there is a MQServer install and not clients, will this cause the error? |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jan 31, 2019 9:16 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
fernandovch wrote: |
If in the server there is a MQServer install and not clients, will this cause the error? |
hughson wrote: |
The Node.js package is not part of the IBM MQ install |
I don't think Morag could have been clearer. If you only have the standard IBM MQ install, that doesn't contain the JavaScript component.
Read the link provided once more. Or once. And if you've followed the directions to install the JavaScript package, post exactly what you did and exactly what happened when you did each step. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
hughson |
Posted: Thu Jan 31, 2019 2:02 pm Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
fernandovch wrote: |
Error: Cannot find module 'ibmmq'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
The server admin tells me that the IBMMQ it is install.
This is the code:
Code: |
mq = require('ibmmq'); // import the package containing the MQI library |
|
I'm sorry my statement wasn't clear. When I said the Node.js package, I was refering to the ibmmq package which you are endeavouring to import in your code. This package, called ibmmq, is a Node.js package. This package is not part of the IBMMQ installation. You can find the link to download this Node.js package called ibmmq from the document I referred you to earlier.
Hope this makes it clearer for you.
Cheers,
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
markt |
Posted: Thu Jan 31, 2019 11:55 pm Post subject: |
|
|
 Knight
Joined: 14 May 2002 Posts: 508
|
The ibmmq package is integrated with the standard npm repository manager in the same way as all other Node.js packages. So you can either install it explicitly, or implicitly via the package.json file associated with your program. |
|
Back to top |
|
 |
fernandovch |
Posted: Thu Feb 07, 2019 6:01 am Post subject: |
|
|
Newbie
Joined: 23 Jan 2019 Posts: 4 Location: Costa Rica
|
Hi everyone,
thanks for the replys, there is problem with the package, its not install correctly or something its worng with it.
I cant install it or updated it because of my user in that server, I waiting for IT to help me with that.
Cheer. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Feb 09, 2019 8:04 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
fernandovch wrote: |
Hi everyone,
thanks for the replys, there is problem with the package, its not install correctly or something its worng with it.
I cant install it or updated it because of my user in that server, I waiting for IT to help me with that.
Cheer. |
It may require an installation of the mqclient libraries. If you don't have those installed, you may just be SOL.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|