Headlands Firehose Edition Is Available

The "Firehose" release (v0.0.4) headlands (a JCache based in-memory grid) delivers CacheEntryEvents via WebSockets in JSON-format.

Cache change events can be received in real-time from Java clients:

import javax.websocket.ContainerProvider;
import javax.websocket.DeploymentException;
import javax.websocket.WebSocketContainer;

public class NotificationsReceiver extends Endpoint {

    public void onOpen(Session session, EndpointConfig ec) {
        this.session = session;
        this.session.addMessageHandler(new MessageHandler.Whole<String>() {

            public void onMessage(String msg) {


WebSocketContainer containerProvider = ContainerProvider.getWebSocketContainer();
NotificationsReceiver messagesEndpoint = new NotificationsReceiver();
containerProvider.connectToServer(this.messagesEndpoint, new URI("ws://localhost:8080/headlands/firehose/" + channel));

...or JavaScript:

   this.callback = function(payload){

  let socket = new WebSocket(`ws://${this.uri}/headlands/firehose/*`);
   socket.onmessage =  (event) => {
   socket.onopen = (event) => {
     console.log("socket connection established",event);

See you at: Building HTML 5 Applications with react.js and Java EE 7 workshops at MUC Airport!

Web Apps, SPA, PWA with vanilla Java Script (ES 6+), CSS 3 and WebStandards only. As simple as possible, but not simpler. See you at: (Progressive) Web apps, Single Page Apps and WebStandards airhacks workshops at MUC airport, Winter Edition

airhacks.fm the podcast:

Stay in touch: airhacks.news.


Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
...the last 150 posts
...the last 10 comments