AndreaNobili
AndreaNobili

Reputation: 43057

How can I correctly configure this WSO2 Scheduled Task to perform a simple REST service call?

I am pretty new in WSO2 ESB (I am using it under EI 6) and I have the following problem. I have to create a simple scheduled taks that every 5 seconds perform a call to a REST service like this:

http://XXX.YYY.ZZZ.HHH:8280/info/country/senegal

So following the official documentation I created a scheduled task into my ESB project, it contains this configuration:

<?xml version="1.0" encoding="UTF-8"?>
<task class="org.apache.synapse.startup.tasks.MessageInjector" group="synapse.simple.quartz" name="TestTask" xmlns="http://ws.apache.org/ns/synapse">
    <trigger count="5" interval="5"/>
</task>

that I think means: "for 5 times perform an operation every 5 seconds".

Ok but I can't understand how to specify how to call the previous REST WS.

I found this link that contains information about how to "Injecting messages to RESTful Endpoints":

https://docs.wso2.com/display/ESB481/Adding+and+Scheduling+Tasks

But I am not understanding what exactly I have to do to set this scheduled call.

Reading on this documentation it says that:

In order to use the Message Injector to inject a message to a RESTful endpint, we can specify the injector with the required payload and inject the message to sequence or proxy service as defined above. The sample below shows a RESTful message injection through a ProxyService.

I think that this Message Injector is the scheduled taks component that perform the call to my REST endpoint (correct me if I am doing wrong assertion, I am absolutly not sure of it). What is the mentioned ProxyService and what it is used for? It seems to me the REST web service configuration container. Something that it is executed to perform my call.

But I have so many doubts...can you help me to perform my simple call to my REST WS?

Thank you

Upvotes: 0

Views: 499

Answers (1)

gusto2
gusto2

Reputation: 12087

In the document page you've linked check the part Injecting the message to a named sequence or proxy service. So you can build a simple proxy service or a sequence to call your service endpoint and the task would invoke the sequence or proxy with the defined message

Upvotes: 1

Related Questions