Lightstreamer - Chat-Tile Demo - Java Adapter
The Chat-Tile Demo implements a simple chat/collaborative application based on Lightstreamer for its real-time communication needs.
This project shows the Data Adapter and Metadata Adapters for the Chat-Tile Demo and how they can be plugged into Lightstreamer Server.
This project includes the implementation of the SmartDataProvider interface and the MetadataProviderAdapter interface for the Lightstreamer Chat-Tile Demo. Please refer to General Concepts for more details about Lightstreamer Adapters.
Java Data Adapter and MetaData Adapter
The Data Adapter accepts message submission for the unique chat room. The sender is identified by an IP address and a nickname.
The Metadata Adapter inherits from the reusable LiteralBasedProvider and just adds a simple support for message submission. It should not be used as a reference for a real case of client-originated message handling, as no guaranteed delivery and no clustering support is shown.
The Adapter Set Configuration
This Adapter Set is configured and will be referenced by the clients as
adapters.xml file for the Chat-Tile Demo, should look like:
<?xml version="1.0"?> <adapters_conf id="CHATTILE"> <metadata_adapter_initialised_first>Y</metadata_adapter_initialised_first> <metadata_provider> <adapter_class>com.lightstreamer.adapters.ChatTileDemo.ChatTileMetaAdapter</adapter_class> <!-- TCP port on which Sun/Oracle's JMXMP connector will be listening. --> <param name="jmxPort">9999</param> <messages_pool> <max_size>1000</max_size> <max_free>10</max_free> </messages_pool> </metadata_provider> <data_provider> <adapter_class>com.lightstreamer.adapters.ChatTileDemo.ChatTileAdapter</adapter_class> </data_provider> </adapters_conf>
NOTE: not all configuration options of an Adapter Set are exposed by the file suggested above.
You can easily expand your configurations using the generic template, see the Java In-Process Adapter Interface Project for details.
Please refer here for more details about Lightstreamer Adapters.
If you want to install a version of this demo in your local Lightstreamer Server, follow these steps:
- Download Lightstreamer Server (Lightstreamer Server comes with a free non-expiring demo license for 20 connected users) from Lightstreamer Download page, and install it, as explained in the
GETTING_STARTED.TXTfile in the installation home directory.
- Get the
deploy.zipfile of the latest release, unzip it, and copy the just unzipped
ChatTilefolder into the
adaptersfolder of your Lightstreamer Server installation.
- [Optional] Customize the logging settings in log4j configuration file:
- Launch Lightstreamer Server.
- Test the Adapter, launching the client listed in Clients Using This Adapter.
To build your own version of
example-ChatTile-adapter-java-0.0.1-SNAPSHOT.jar instead of using the one provided in the
deploy.zip file from the Install section above, you have two options:
either use Maven (or other build tools) to take care of dependencies and building (recommended) or gather the necessary jars yourself and build it manually.
For the sake of simplicity only the Maven case is detailed here.
You can easily build and run this application using Maven through the pom.xml file located in the root folder of this project. As an alternative, you can use an alternative build tool (e.g. Gradle, Ivy, etc.) by converting the provided pom.xml file.
Assuming Maven is installed and available in your path you can build the demo by running
mvn install dependency:copy-dependencies
Clients Using This Adapter
- Lightstreamer - Chat Demo - Java Adapter
- LiteralBasedProvider Metadata Adapter
- Lightstreamer - Basic Messenger Demo - Java Adapter
- Lightstreamer - Basic Messenger Demo - HTML Client
Lightstreamer Compatibility Notes
- Compatible with Lightstreamer SDK for Java In-Process Adapters since 7.3.
- For a version of this example compatible with Lightstreamer SDK for Java Adapters version 6.0, please refer to this tag.
- For a version of this example compatible with Lightstreamer SDK for Java Adapters version 5.1, please refer to this tag.