0

I do http request ({f_id:1001}) to http service. Service return me only true/false in result without source f_id.

And want to select response of it with source F_ID:

@sink(type='http-request', publisher.url='http://127.0.0.1:3020/', 
    method="POST", sink.id='download-sink', @map(type='json'))
define stream OutputToNodejs(f_id long);

@source(type='http-response' , sink.id='download-sink', 
    http.status.code='200',
    @map(type='json', @attributes('result'))) 
define stream responseStream2xx(result bool);

@info(name = 'SimpleLogTrigger')
from responseStream2xx 
    select result as text, f_id_from_request /* HOW GET F_ID from source request HERE */
    insert into OutputStream2;

And I want to use source request message in select from source response. But how I can get source message here? If I cannot - may be I can forward some id of it from request to response?

1 Answer 1

1

There is no out of the box way to do this currently. There are two workarounds to get this done.

  1. Make your service return f_id too in the response and get it inside the response stream
  2. Add an improvement to HTTP request sink and HTTP response source so that source can access sink's stream variables. But this will be a major development effort. So I think number one is the better option given that you have governance over HTTP service.
Sign up to request clarification or add additional context in comments.

2 Comments

What's about case, when service will be not available, so I can't to check result by f_id from response?
I guess you want to retry same f_id incase service is not available. In that case currently we won't be able to achieve this according to my knowledge. However you can raise an issue in project github repo requesting this as an improvement and request for number 2 option

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.