1

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.

Omkar Shetkar
  • 3,488
  • 5
  • 35
  • 50

2 Answers2

1

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.

Omkar Shetkar
  • 3,488
  • 5
  • 35
  • 50
0

@EnableTaskLauncher annotation is missing in TaskIntakeApplication.

@SpringBootApplication
@EnableTaskLauncher
public class PluralsightSpringcloudM3TaskintakeApplication {

    public static void main(String[] args) {
        SpringApplication.run(PluralsightSpringcloudM3TaskintakeApplication.class, args);
    }
}
Ravikiran
  • 45
  • 1
  • 7
  • I suppose @EnableTaskLauncher should be with sink task. After I made suggested change, getting following error: Field taskLauncher in org.springframework.cloud.task.launcher.TaskLauncherSink required a bean of type 'org.springframework.cloud.deployer.spi.task.TaskLauncher' 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 'org.springframework.cloud.deployer.spi.task.TaskLauncher' in your configuration. – Omkar Shetkar Oct 27 '18 at 13:47