0

I have a server and i can call my web-service from this server. So i call web-service, the web-service send me a answer and i want according answer run application. For example:

    answer=curl -i  -X GET "http://myserver.com/getStaus";
     switch (answer)
        {
            case 'ON':
                saveToQueue('http://myserver.com/getApp1','ON');
                do
                    {
                        retryQueueForSend('ON');            
                    }while !(lengthQueueForSend('ON')==0)
                    break;
            case 'OFF':
                saveToQueue('http://myserver.com/getApp2','OFF');
                do
                    {
                        retryQueueForSend('OFF');            
                    }while !(lengthQueueForSend('OFF')==0)
                    break;

            case 'TimeOut':
                saveToQueue('http://myserver.com/getApp3','TimeOut');
                do
                    {
                        retryQueueForSend('TimeOut');            
                    }while !(lengthQueueForSend('TimeOut')==0)
                    break;
        }
public void saveToQueue(String LinkOfWebservice,String nameOfQueue)
{
...
...
..
}
public void retryQueueForSend(String nameOfQueue)
{
...
...
..
}
public int retryQueueForSend(String nameOfQueue)
{
...
...
return len;
}

So i want implement this scenario on wso2 Enterprise Service Bus(ESB). I think i have to use wso2 Message Broker(MB). Thanks in advice.

Community
  • 1
  • 1

1 Answers1

0

You can use WSO2 ESB for this implementation.

Use REST API [1] to call your service in "http://myserver.com/getStaus". In out sequence of REST API, you can switch mediator[2] to identify response (Check whether ON, OFF or timeout). According to that perform your task.

You do not need WSO2 MB for this implementation.

Note: I assume you mean run app1 as calling a backend or running another API

[1]https://docs.wso2.com/display/ESB500/Working+with+APIs [2]https://docs.wso2.com/display/ESB500/Switch+Mediator

Dilshani Subasinghe
  • 1,922
  • 2
  • 12
  • 14