on 2022 Nov 08 1:02 PM
Hello,
I'm currently learning CAP Java and trying to implement an event messaging service using the Message Queue Message Broker.
Before I can use the broker I have to configure it in my application.yaml file. (as described in the cap documentation)
I did this as follows:
spring:
config.activate.on-profile: default
cds:
messaging.services:
- name: "messaging"
kind: "message-queuing"
Whenever I try to start the application I get the following error:
***************************
APPLICATION FAILED TO START
***************************
Description:
Field messagingService in customer.message_que_send.handlers.CatalogServiceHandler required a bean of type 'com.sap.cds.services.messaging.MessagingService' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'com.sap.cds.services.messaging.MessagingService' in your configuration.<br>
What am I doing wrong in my config?
Or is there another problem?
Thanks for your help.
Request clarification before answering.
Hello Simon,
you can check the startup log of your application whether the 'messaging' service was registered and initialised properly? Did you install the MQ dependencies in your application pom:
<dependency>
<groupId>com.sap.cds</groupId>
<artifactId>cds-feature-message-queuing</artifactId>
<scope>runtime</scope>
</dependency>
and be carefully with the indentations in the application.yaml:
spring:
config.activate.on-profile: default
cds:
messaging.services:
- name: "messaging"
kind: "message-queuing"Regards,
Dietrich
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your answer!
I correctly indented the config in my application.yaml and have set the dependencies for MQ in my pom.xml.
Unfortunately I still get the error message.
Where can I see if the messaging service has been registered correctly?
I tried event messaging with file-based-messaging, this worked but with MQ I always get the error message as described above.
In the startup log of the application you can find all services registrations.
For anyone who has the same problem.
My solution was to bind the cloud service to my application. This is described in this article (Hybrid Testing): https://cap.cloud.sap/docs/advanced/hybrid-testing
First the service needs to be bound with:
cds bind -2 my-hana:my-hana-key.
After that, the application must be started as follows:
cds bind --exec mvn spring-boot:run
can u give demo for java cap messaging please
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 17 | |
| 8 | |
| 7 | |
| 6 | |
| 4 | |
| 4 | |
| 4 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.