Quartz service is not working using Spring Feign Client

Viewed 177

I create a real time notification functionality using spring quartz library. I create two services as bellow : 1) quartz-service : Which is used to set schedule a for real time notification. 2) task-service : Which is used to create a task and remind through quartz-service.

When task-service call quartz-service through feign client I'm not get any response. But If I call through Rest Template it's working find.

Actually we are used spring boot microservice architecture, In using Rest Template we need to specify URL Hard coded, So we can't achieved Ribbon concept in this case that's why we not interest to use Rest Template.

So please help me if any once face this problem.

quartz-service :

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-quartz</artifactId>
    </dependency>
   <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

Rest Controller :

 @RestController
    @RequestMapping(value = "/quartz/taks", produces = "application/hal+json")
    public class QuartzTaskController
    {   
        @Autowired
        private QuartzTaskServices quartzTaskServices;      

        @PostMapping("/reminder")
        public ResponseEntity<Object> saveTaskReminder(@RequestBody Task task)
        {
            quartzTaskServices.saveTaskReminderScheduler(task);
            return ResponseEntity.ok().build();
        }
    }

task-service

Dependency :

<dependency>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency>

Feign Client :

@RibbonClient(name="quartz-services")
@FeignClient(name="quartz-services")
public interface QuartzProxy
{
    @PostMapping("/quartz/taks/reminder")
    public ResponseEntity<Object> saveTaskReminder(@RequestBody Task task);
}

Call Feign Client :

@Autowired
private QuartzProxy quartzProxy;
...
.....
......
quartzProxy.saveTaskReminder(task);
0 Answers
Related