npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jms-lib

v0.1.10

Published

java message services client midware

Downloads

4

Readme

Java Message Services Client

多种 jms 服务器的支持

install npm jms-lib --save

驱动支持

  • OpenMQ -- GlassFish(tm) Server Message Queue
  • ActiveMQ -- Apache ActiveMQ
  • HornetQ -- JBoss HornetQ
  • ibmMQ -- IBM WebSphere MQ
  • WebLogic -- Oracle WebLogic MQ

Usage

var jms = require('jms-lib');
jms.initJava(require('java'));

// 到 jms 服务器的连接配置
var opt = {
  driver: 'OpenMQ',
  host: 'localhost',
  port: 7676,
  user: 'admin',
  pass: 'admin'
};

// 在连接失败的时候会抛出异常
var conn = jms.open(opt);

var sess = conn.createSession();

// 从一个主题名称生成消息创建者, isTopic -- true 创建订阅主题目标
var prod = sess.createProducer('test', isTopic);

// 发送各种消息
prod.send(null);
prod.send('hello jms');
prod.send(new Buffer(10));

// 只能发送简单对象, 不允许深度对象嵌套
prod.send({ a:1, b:2 });

// 从一个主题名称生成消息消费者
var cons = sess.createConsumer('test', {
    name            : 'SubscriptionName',
    messageSelector : string,
    noLocal         : boolean,
    shared          : boolean, 共享的默认 true
    durable         : boolean, 持久化的默认 false
});

// 监听消息, 注意当最后一个 v8 任务结束后, 进程会退出
// type -- Text 返回字符串, Bytes 返回 Buffer, Map 返回对象
//         Object 返回 java 对象, Stream 返回 stream.Readable
cons.onData(function(type, msg) {
  console.log(type, msg);
});

// not_wait - false 等待 timeout 时间同步获取消息
// 如果等待了 timeout 或 not_wait==true 可能返回 null
var msg = cons.receive(timeout, not_wait);

// 开始接受消息
conn.start();

// 关闭连接
conn.close();

JAR 依赖

  • JMS 接口

    • jms.jar
  • GlassFish(tm) Server Message Queue OpenMQ

    • imq.jar
    • imq_l10n.jar
    • imqxm.jar
  • WebLogic Server

    • wlclient.jar
    • wljmsclient.jar
  • Apache ActiveMQ ™

    • activemq-client-5.11.1.jar
    • geronimo-j2ee-management_1.1_spec-1.0.1.jar
    • slf4j-api-1.7.10.jar
  • JBoss HornetQ

    • hornetq-jms-client.jar
    • hornetq-core-client.jar
    • hornetq-commons.jar
    • jnp-client.jar
    • netty.jar
  • IBM WebSphere MQ

    • com.ibm.mq.allclient.jar
    • com.ibm.mq.traceControl.jar
    • fscontext.jar
    • JSON4J.jar
    • providerutil.jar

参考