Update msmq.js

This commit is contained in:
Namhyeon Go 2021-09-23 13:58:16 +09:00
parent c0f8159735
commit cfb2c65541

View File

@ -28,10 +28,12 @@ var MSMQObject = function(queueName) {
} catch (e) { } catch (e) {
console.error("MSMQObject.create() ->", e.message); console.error("MSMQObject.create() ->", e.message);
} }
return this;
} }
this.open = function() { this.open = function() {
this.queue = this.queueInfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE); this.queue = this.queueInfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE);
return this;
} }
// For example: .send("Sample Body", "LabelXX"); // For example: .send("Sample Body", "LabelXX");
@ -40,7 +42,7 @@ var MSMQObject = function(queueName) {
mqmsg.Body = body mqmsg.Body = body
mqmsg.Label = label mqmsg.Label = label
mqmsg.Send(this.queue); mqmsg.Send(this.queue);
mqmsg = null; return mqmsg;
}; };
this.recv = function() { this.recv = function() {
@ -49,3 +51,8 @@ var MSMQObject = function(queueName) {
this.create(); this.create();
}; };
exports.MSMQObject = MSMQObject;
exports.open = function(queueName) {
return (new MSMQObject(queueName)).open();
};