Giter Site home page Giter Site logo

mrts / vaadin-javaee-jms-server-push-example Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 1.0 33 KB

An example Vaadin 8 Java EE application that demonstrates how to use Vaadin's server push along with Java EE JMS messaging APIs

License: MIT License

Java 80.77% CSS 19.23%
vaadin vaadin-cdi-addon javaee jms message-driven-bean vaadin-push websocket vaadin-testbench

vaadin-javaee-jms-server-push-example's Introduction

vaadin-javaee-jms-server-push-example

An example Vaadin 8 Java EE application that demonstrates how to use Vaadin's server push and Java EE messaging APIs to send messages to client browsers in real time. Uses JMS 2.0 API for sending messages, message-driven beans for receiving them and a separate singleton broadcaster to broadcast messages to Vaadin UIs (the broadcaster is recommended by Vaadin as a bridge for connecting message-driven beans and Vaadin UIs that have different lifetimes). Vaadin's server push uses a WebSocket connection by default.

Tested with WildFly 10.1, but should work equally well with other Java EE 7 application servers (and probably Java EE 6 application servers once you downgrade the javaee-api Maven dependency; you also need to change JMS APIs and configuration).

Building and running

You need Maven and Java 8 JDK to build and run the application.

Build the application WAR with mvn package, deploy it from target/vaadin-javaee-server-push-example-1.0-SNAPSHOT.war to the application server.

Note that you need to run WildFly with full profile to enable JMS:

bin/standalone.{bat,sh} -c standalone-full.xml

Testing

  1. Open http://localhost:8080/vaadin-javaee-server-push-example-1.0-SNAPSHOT/receive-message in one browser window
  2. Open http://localhost:8080/vaadin-javaee-server-push-example-1.0-SNAPSHOT/send-message in second browser window
  3. Type a message and press Send message
  4. Switch to the first window and observe that the message is visible on the page

There is also a Vaadin TestBench test in SendAndReceiveMessageTest.java.

If you have a TestBench licence and Chrome WebDriver installed, you can run it with

mvn test

References

vaadin-javaee-jms-server-push-example's People

Contributors

mrts avatar

Watchers

 avatar  avatar  avatar

Forkers

vlk-a

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.