Search code examples
rabbitmqspring-cloudspring-cloud-streamspring-cloud-task

Spring Cloud Task not started with Spring Cloud Stream using RabbitMQ


I am experimenting with Spring Cloud APIs as part of microservices course.

To setup server-less task, I am using Cloud Task, Cloud Stream(RabbitMQ), and Spring Web.

For this I have setup following projects:

Serverless task to be executed - https://github.com/Omkar-Shetkar/pluralsight-springcloud-m3-task

Component to receive Http request from user and submit to RabbitMQ - https://github.com/Omkar-Shetkar/pluralsight-springcloud-m3-taskintake

Sink component to receive TaskLaunchRequest and forward to cloud task - https://github.com/Omkar-Shetkar/pluralsight-springcloud-m3-tasksink

Having setup above components, ensured that task component is available in local maven repository. enter image description here

After initiating a POST request onto /tasks in pluralsight.com.TaskController.launchTask(String) I see a HTTP response.

enter image description here

But, I couldn't see any update in tasklogs DB associated with serverless task. This means, task it self is not called.

In RabbitMQ console I could see connections are established from intake and sink components but I don't see any message exchange happening.

enter image description here

Queue with name tasktopic is having ZERO message count.

enter image description here

Appreciate any pointers and suggestions on how to proceed on this to resolve this issue.

Thanks.


Solution

  • There were two issue with my current implementation:

    In intake and sink modules -> application.properties, binding property key was wrong.

    It should be:

    In intake module

    spring.cloud.stream.bindings.output.destination=tasktopic
    

    In sink module

    spring.cloud.stream.bindings.input.destination=tasktopic
    

    Also, local cloud deployer versions were incompatible in sink modules pom.xml.

    Updated the same to:

       <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-deployer-local</artifactId>
            <version>1.3.0.RELEASE</version>
        </dependency>
    

    With these changes, I am able to get RabbitMQ messages.