SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Create App for Sending and Receiving Messages Using a Java-Based Client

Develop and deploy a basic Java-based messaging application for sending and receiving messages to a queue.

Overview

🎓 intermediate 45 min. SAP Event MeshIntermediateJavaSAP Business Technology Platform

You will learn

  • How to create a basic messaging client application with Java
  • How to deploy this application to the SAP Event Mesh and test it
Unknown U Unknown November 1, 2022
Created by March 29, 2021
Contributors

Prerequisites

Prerequisites

Steps

Step 1 Set up environment

To download and install the samples, just clone the repository via: git clone

The git has two applications for you to try out.

ApplicationScenario Description
emjapi-samples-jms-p2p (Point to Point communication)This sample demonstrates how messages can be sent and received from an application deployed on SAP Business Technology Platform. Therefore the messaging sample provides a Spring Boot based application which provides REST endpoints for sending and receiving messages via a queue (or queues) of choice. The REST endpoints are provided via the MessagingServiceRestController.
ApplicationScenario Description
emjapi-samples-jms-pubsub (Publish & Subscribe)This sample demonstrates how messages can be sent and received to a topic from an application deployed on SAP Business Technology Platform. This messaging sample provides a Spring Boot based application which provides REST endpoints for sending and receiving messages via a topic of choice. It also offers a REST endpoint to receive a message from a queue. The REST endpoints are provided via the MessagingServiceRestController.

Download both the scenarios to your local IDE. After downloading, the project structure will look like this :

Project Structure
Project Structure

The downloaded project has all the dependencies and required client files for both scenarios mentioned above. The Event Mesh service descriptor is /config/em-config-default.json. Detailed information on different parameters of the descriptor can be found in Create Instance of SAP Event Mesh.

Replace the content in the .json file with the content of the descriptor in the service instance you have created.

Step 2 Understand the dependencies
+
Step 3 Code Snippets — common for both examples
+
Step 4 Code Snippets — Point to Point communication
+
Step 5 Code Snippets — Publish and Subscribe
+
Step 6 Build and deploy
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 6
1. Set up environment 2. Understand the dependencies 3. Code Snippets — common for both examples 4. Code Snippets — Point to Point communication 5. Code Snippets — Publish and Subscribe 6. Build and deploy

Learn more →