Giter VIP home page Giter VIP logo

jmsextender-lib-client-javascript's Introduction

Lightstreamer JMS Extender Client SDK

This JavaScript library enables any JavaScript application running in a web browser or a Node.js container to connect to a JMS broker via JMS Extender or Lightstreamer Server with JMS Extender Adapter.

The library is designed to be as class-by-class and method-by-method equivalent to JMS API 2.0 as possible. Some differences still apply, mainly due to JavaScript asynchronous nature. Most notably, some JMS synchronous APIs, like createConnection, here require a callback and will be called asynchronously.

Quickstart

Following is an example of a topic connection and subscription:

jms.ConnectionFactory.createConnection("http://my.push.server:8080/", "ActiveMQ", null, null, {
        onConnectionCreated: function(conn) {
            conn.setExceptionListener({
                onException: function(exception) {
                    // Handle exceptions here
                }
            });

            var session = conn.createSession(false, "PRE_ACK");
            var topic = session.createTopic("stocksTopic");
            var consumer= session.createConsumer(topic, null);

            consumer.setMessageListener({
                onMessage: function(message) {
                    // Handle messages here
                }
            });

            conn.start();

        },
        onConnectionFailed: function(errorCode, errorMessage) {
            // Handle server errors here, e.g.:
            alert("Server error: " + errorCode + " " + errorMessage);
        }
    });

Following is an example of a queue connection and message send:

jms.ConnectionFactory.createConnection("http://my.push.server:8080/", "ActiveMQ", null, null, {
        onConnectionCreated: function(conn) {
            conn.setExceptionListener({
                onException: function(exception) {
                    // Handle exceptions here
                }
            });

            var session = conn.createSession(false, "AUTO_ACK");
            var queue = session.createQueue("stocksQueue");
            var producer = session.createProducer(queue, null);

            var msg = session.createTextMessage("some text");
            producer.send(msg);

            conn.start();

        },
        onConnectionFailed: function(errorCode, errorMessage) {
            // Handle server errors here, e.g.:
            alert("Server error: " + errorCode + " " + errorMessage);
        }
    });

npm Packages

The library is available as npm package, so you can download and install it through:

npm install lightstreamer-jms-web-client

or

npm install lightstreamer-jms-node-client

Building

To build the library, enter the directory tools and run the command node build_web.js or the command node build_node.js. The first time you should also enter the root directory of the project and run the command npm install in order to install the dependencies required by the build scripts. The scripts require Node.js version 14 or greater.

The artifacts generated are saved in the directories tools/dist-web and tools/dist-node.

Documentation

Support

For questions and support please use the Official Forum. The issue list of this page is exclusively for bug reports and feature requests.

License

Apache 2.0

jmsextender-lib-client-javascript's People

Contributors

acarioni avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.