mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-09 05:06:04 +00:00
Update msmq.js
This commit is contained in:
parent
c0f8159735
commit
cfb2c65541
11
lib/msmq.js
11
lib/msmq.js
|
@ -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,12 +42,17 @@ 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() {
|
||||||
return this.queue.Receive(MQ_NO_TRANSACTION, false, true, 20000, false);
|
return this.queue.Receive(MQ_NO_TRANSACTION, false, true, 20000, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.create();
|
this.create();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.MSMQObject = MSMQObject;
|
||||||
|
exports.open = function(queueName) {
|
||||||
|
return (new MSMQObject(queueName)).open();
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user