ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexIBM MQ API SupportHow to use node.js connect to the mq

Post new topicReply to topic
How to use node.js connect to the mq View previous topic :: View next topic
Author Message
gaorenwei
PostPosted: Wed Dec 26, 2018 9:48 pm Post subject: How to use node.js connect to the mq Reply with quote

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
View user's profile Send private message
hughson
PostPosted: Thu Dec 27, 2018 2:34 am Post subject: Reply with quote

Grand Master

Joined: 09 May 2013
Posts: 1139
Location: Bay of Plenty, New Zealand

Does this help?

Node.js and IBM MQ

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
fernandovch
PostPosted: Thu Jan 24, 2019 3:04 pm Post subject: Reply with quote

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
View user's profile Send private message
hughson
PostPosted: Thu Jan 24, 2019 3:20 pm Post subject: Reply with quote

Grand Master

Joined: 09 May 2013
Posts: 1139
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
View user's profile Send private message Visit poster's website
fernandovch
PostPosted: Thu Jan 31, 2019 9:09 am Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Thu Jan 31, 2019 9:16 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25722
Location: Ohio, 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
View user's profile Send private message
hughson
PostPosted: Thu Jan 31, 2019 2:02 pm Post subject: Reply with quote

Grand Master

Joined: 09 May 2013
Posts: 1139
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
View user's profile Send private message Visit poster's website
markt
PostPosted: Thu Jan 31, 2019 11:55 pm Post subject: Reply with quote

Chevalier

Joined: 14 May 2002
Posts: 415

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
View user's profile Send private message
fernandovch
PostPosted: Thu Feb 07, 2019 6:01 am Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Sat Feb 09, 2019 8:04 pm Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20021
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
View user's profile Send private message Send e-mail
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexIBM MQ API SupportHow to use node.js connect to the mq
Jump to:



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
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.