Posts tagged push
WebLogic 12c (12.1.2) has support for WebSockets. ADF 12c runs on WebLogic 12c. Therefore, we should be able to leverage that WebSockets support in an ADF application. And indeed we can, as this article describes. It will explain the creation of a simple application – the SlidePresenter – that allows users to select an image from a carousel. As soon as they make the selection, all currently connected clients are synchronized, showing the same slide:
The application uses a WebSocket endpoint – an object that acts as the server end for web socket connections. Each browser session connects to the end point and starts a new websocket connection. Whenever a slide is selected, the WebSocket endpoint is informed (on the server side) and broadcasts the slide selection to all connected clients. A brief demo of what this looks like is shown here:Pushy in Sockets – demo
The application also support an automatic slideshow: one user starts the slideshow by pushing a button. This causes a scheduled future to be instantiated in the server that fires every 3 seconds to advance the slideshow. After two minutes, the show will finish.
The application can be downloaded under Resources. It runs More >
Real time events can be translated into a live visual representation using a largely declarative approach. Events can be published for example on a JMS Topic. Using Oracle BAM (Business Activity Monitor, component of the SOA Suite), this JMS Topic can be subscribed to. The events arriving on the Topic are used to update a BAM Data Object in the Active Data Cache. ADF provides a BAM Data Control that can be defined against the BAM Data Object. ADF Data Visualization Components support an active mode that does automatic server push to the browser. Using these DVT components, it is straightforward to create charts that are live updated in the browser.
Welding these components together, this article will explain how we can create a streaming line chart that represents the score in a volleyball match.
The steps described in this article:
In this article, I show how I have created a simple and fairly meaningless Java EE 7 application that uses a number of smart Java EE features:
- a stateless session bean has a scheduled method (that is triggered every 3 seconds)
- the stateless session bean publishes custom CDI events
- a class annotated as WebSocket EndPoint manages WebSocket channels with WS clients (in this case simple HTML browser applications) – echoing messages between the clients
- the WebSocket Endpoint also observes the CDI event and pushes the event payload to each of the WebSocket clients
Using NetBeans 7.3.1 and GlassFish 4.0 – as well as a number of blog-articles and sample applications – this turned out to be very simple to put together.
This next figure visualizes what I did:
The important steps to come to a running applications are:
- create new Java EE 7 project in NetBeans
- create class TimeEvent that will be used to publish as CDI event
- create class EventProducer – a stateless EJB session bean that is scheduled to trigger every 3 seconds; it publishes a TimeEvent whenever it is triggered
- create class SocketMediator – an annotated POJO that has the ServerEndpoint annotation (to More >
Session at JavaOne come in various shapes. Some are visionary, high level and future oriented. Others are detailed and discuss practical, sometimes very fine grained topics. One of the sessions I attended was somewhere in between: future oriented yet pretty concrete at the same time. It was probably my favorite session at JavaOne this year: What’s new in Servlet3.1: An Overview by Shing Wai Cha and Rajiv Mordani. The passion of the presenters – their enthusiasm to explain the current development of the Servlet API and their ability to demonstrate some rather tough concepts were pivotal. Many presenters can take their style as an example they can learn from.
The Servlet 3.1 API is part of the JEE 7 edition- that is scheduled for complete release in April 2013. The Servlet Specification is largely complete, although some elements are still under discussion as became clear during this talk. The probably most important new requirement in Servlet 3.1 is the ability to do Web Socket interaction. Web Sockets is a relatively new communication protocol that runs over TCP/IP and goes beyond HTTP in several respects. Web Sockets support bi-directional interactions (open channels through More >
Performance of Enterprise Java Applications is a requirement and usually a challenge. Business requirements on systems can be stiff, successful systems can easily be overloaded and complex application architectures can add a burden too. Improving performance by tuning the application after it has been built seldomly renders huge improvements. By taking a step back – or even two – and regarding the application and the performance from a distance, it becomes possible to really design and architect for performance according to the ISYITF-method: it is staring you in the face. Order of magnitude improvements are attainable through logical reasoning and careful application of multi-tier architecture principles and JEE platform facilities.
This is the abstract for the session Thinking Through Java Enterprise Performance that I will be presenting on Tuesday October 2nd at JavaOne 2012 (BOF 4712 4:30 PM – 5:15 PM – Parc 55 – Cyril Magnin I.
Notifying ADF applications of database changes – fast and lean using Active Data Service for Server to Client Push – Part Two0
Yesterday I wrote that in two articles, I would demonstrate how we can ensure that changes in the database – new, changed or deleted data – can rapidly be reflected in ADF based user interfaces running in browsers. This story involves a two-step push-mechanism: push from database to middle tier and push from middle tier to browser. For the former – discussed in Notifying ADF applications of database changes – fast and lean using Database Query Result Change Notification – Part One – we will use the Oracle Database (and JDBC Driver) feature Query Result Change Notification and for the latter we leverage the Active Data Service in ADF Faces. The latter – server to browser push – is the topic of this second part. It will hook into where the first part took us (so you are advised to first read part one) and take the changes the database notifies us all the way up into the user interface.
A sketch of the architecture of the application we will create in this article looks like this:
The two push steps are marked with the green ellipses. The red box indicates the area under scrutiny in this article.