Connect Java Application
One the previous step of the tutorial, we provisioned a cluster. After provisioning is complete, and the cluster is available, you can connect your application. Nebula will offer you common connection parameters.
In this tutorial, we will connect to Nebula by using a simple Java thin client in the provided Java application.
Get connection information
The last step of the provisioning wizard provides the connection examples. Switch to the Java Thin Client connection sample.
On the next step you will need to update the ClientConfiguration cfg
object in the provided demo with the object from the configuration template.
Connect to Nebula
In this tutorial we will use a simple demo application that connects to the cluster and writes 10 random text values in the cache. To connect the demo application to the cluster:
-
Download and unpack the archive with the application or clone in from the Github repository.
-
Open the project in your IDE.
-
Replace the following bit of code with code from the template:
ClientConfiguration cfg = new ClientConfiguration()
.setAddresses("Your-Nebula-Address")
.setUserName("USERNAME")
.setUserPassword("PASSWORD")
.setSslMode(SslMode.REQUIRED);
-
Replace the
USERNAME
andPASSWORD
placeholders with user credentials you have specified previously. -
Run the application.
After the application runs, you will be able to see the newly created cache. It also retrieves new data from the cache and displays it in the log.
Destroy the Cluster
When you are done with cluster, remember to destroy it to avoid spending extra credits or money. Go to the Clusters screen
Connect your Application to Cluster
After you are done with the demo application, connect one of your own as described in the Connecting your Application section. GridGain Nebula works with a wide variety of languages.
You can learn more about using GridGain APIs in the GridGain documentation.
© 2024 GridGain Systems, Inc. All Rights Reserved. Privacy Policy | Legal Notices. GridGain® is a registered trademark of GridGain Systems, Inc.
Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are either registered trademarks or trademarks of The Apache Software Foundation.