Re: [jetty-users] Jakarta REST API Query

2021-06-28 Thread Aniruddha Tekade via jetty-users
Greg,

I was going through your email and just noticed the cleared description
part. So thought I can provide more details on interactions and issues -

   1. Python script creates a S3 client (for my S3 service) and calls
   getObject() API by passing 2 parameters bucket name and object key
   2. getObject() service is received by jetty server and sent to handler
   to serve it
   3. Handler detects the method type GET and passes control to getObject()
   4. in getObject(), java code does 2 things -
  1. gets original object (data) from S3 bucket using bucket name and
  object key
  2. gets name of the lambda function from redis which is mapped for
  bucket name
   5. Jetty makes a call to connectLambdaFunction(original-data,
   lambda-func-name) in flask server
   6. Flask executes the lambda function which performs transformation of
   the data and make response ready
   7. Lambda function creates an S3 instance and makes a call
   s3.write_get_object_response()
   8. writeGetObjectResponse() receives the request and sends the response
   back to python script in step 1.


Best,
Aniruddha


ᐧ

On Sun, Jun 27, 2021 at 6:32 PM Greg Wilkins  wrote:

>
>
> I'm a bit confused by your diagrams and descriptions.  Perhaps a simple
> interaction diagram would help?
>
> If it is just Client ---GET--> Jetty --GET--> Flask, then I'm not seeing
> the problem.  Just async wait for the response from Flask.
>
> But one of your diagrams/descriptions suggests that the sequence is:
>
>1. Jetty receives GET request from client
>2. Jetty sends GET request to Flask which competes
>3. Jetty receives POST request from  Flask, which needs to be matched
>to original GET from client
>4. Jetty sends response to original GET request
>
> Is this the case?   If so, then it's a matter for the API talking to
> Flask, as you must be able to tunnel some id or other that will allow you
> to do the lookup at step 3.
>
> Eitherway, a clearer description of the interaction and the issues you
> have would help.
>
>
>
>
>
>
>
>
> On Mon, 28 Jun 2021 at 11:00, Aniruddha Tekade via jetty-users <
> jetty-users@eclipse.org> wrote:
>
>> Yes, I can remove the flask server and use Jython instead to make this
>> run in the same Java server.
>> But since I am trying to reproduce what AWS does with S3 Object Lambda
>> 
>> -
>>
>> *WriteGetObjectResponse*
>>>
>>> Passes
>>> transformed objects to a GetObject operation when using Object Lambda
>>> Access Points. For information about Object Lambda Access Points, see 
>>> Transforming
>>> objects with Object Lambda Access Points
>>> 
>>>  in
>>> the *Amazon S3 User Guide*.
>>> This operation supports metadata that can be returned by GetObject
>>> ,
>>> in addition to RequestRoute, RequestToken, StatusCode, ErrorCode, and
>>> ErrorMessage. The GetObject response metadata is supported so that the
>>> WriteGetObjectResponse caller, typically an AWS Lambda function, can
>>> provide the same metadata when it internally invokes GetObject. When
>>> WriteGetObjectResponse is called by a customer-owned Lambda function,
>>> the metadata returned to the end user GetObject call might differ from
>>> what Amazon S3 would normally return.
>>
>> I am trying to find a workaround/mechanism to get this to work.
>>
>> Best,
>> Aniruddha
>> 
>>
>> ᐧ
>>
>> On Sun, Jun 27, 2021 at 5:52 PM Bill Ross  wrote:
>>
>>> Speaking from general server dev going back to the 90's, but w/o Amazon
>>> or Flask, so may not apply:
>>>
>>>
>>>- Jetty server now forwards the request to a Python Flask server
>>>which has the lambda function by passing object data to it
>>>- Lambda function code perform the transformation on the object and
>>>POST it back to Jetty server (which is a different API called
>>>writeGetObjectResponse)
>>>
>>> It seems the original GET should be waiting on a synchronous call to the
>>> Flask server (after the sync GET to HS/HSC), and respond by forwarding the
>>> response?
>>>
>>>
>>>
>>> --
>>> Phobrain.com
>>> ___
>>> jetty-users mailing list
>>> jetty-users@eclipse.org
>>> To unsubscribe from this list, visit
>>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>>
>> ___
>> jetty-users mailing list
>> jetty-users@eclipse.org
>> To unsubscribe from this list, visit
>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>
>
>
> --
> Greg Wilkins  CTO http://webtide.com
> ___
> jetty-users mailing list
> jetty-users@eclipse.org
> To unsubscribe from this list, visit
> 

Re: [jetty-users] Jakarta REST API Query

2021-06-27 Thread Aniruddha Tekade via jetty-users
Bill,

I am trying to reproduce this mechanism -

import boto3 import requests def lambda_handler(event, context): print(event
) object_get_context = event["getObjectContext"] request_route =
object_get_context["outputRoute"] request_token = object_get_context[
"outputToken"] s3_url = object_get_context["inputS3Url"] # Get object from
S3 response = requests.get(s3_url) original_object = response.content.decode
('utf-8') # Transform object transformed_object = original_object.upper() #
Write object back to S3 Object Lambda s3 = boto3.client('s3') s3.
write_get_object_response( Body=transformed_object, RequestRoute=
request_route, RequestToken=request_token) return {'status_code': 200}

As you can see that the Get Object operation is done by the jetty server,
transform object is done by lambda function but when you need to write
object back to Get Object  client, its done by the S3 Object Lambda which
is a java server in my case.

My ultimate goal is clients will be creating only a simple python
getRequest with custom S3 Lambda server address and then S3 Lambda Server
(Java Jetty Server) will perform everything then.

Having said that, when the customer will call the
write_get_object_response() API, it should actually handle the mechanism.
That is why I can not keep it completely synchronous. I must do the last
part in somewhat async way or using some ID. Please let me know if I am
clear.

Best,
Aniruddha


ᐧ

On Sun, Jun 27, 2021 at 9:17 PM Bill Ross  wrote:

> Aniruddha,
>
> How about e.g. (starting from retro code style I assume)
>
> @Override
> public void doGet(HttpServletRequest req, HttpServletResponse res)
> throws ServletException, IOException  {
>
> // get data from HS or HSC with synchronous GET
>
> // pass data to Lambda Server and get response synchronously
>
> // write data back
>
> }
>
> In your case, the Lamda Server gets the data from HS/HSC synchronously,
> but the simple thing seems to be to return it from the Servlet thread
> handling the response, with no async steps along the way. The only reason
> for async that I can imagine is if jetty threads were very expensive
> somehow and couldn't waste time blocked on a request.
>
> Bill
>
>
> On 6/27/21 6:51 PM, Aniruddha Tekade via jetty-users wrote:
>
> Bill,
>
> Flask server only executes the lambda function (transforming the data --
> ex. "my experiment with s3 object lambda".upper()) in python and then
> returns (or calls with) the transformed data in the body of response to
> write_get_object_response() defined with Java Server.
> Best,
> Aniruddha
> 
>
> ᐧ
>
> On Sun, Jun 27, 2021 at 6:33 PM Bill Ross  wrote:
>
>> If the Flask server doesn't do synchronous responses, that would explain
>> my confusion. If it does, you may be misunderstanding me.
>>
>> Bill
>> On 6/27/21 5:59 PM, Aniruddha Tekade via jetty-users wrote:
>>
>> Yes, I can remove the flask server and use Jython instead to make this
>> run in the same Java server.
>> But since I am trying to reproduce what AWS does with S3 Object Lambda
>> 
>> -
>>
>> *WriteGetObjectResponse*
>>>
>>> Passes
>>> transformed objects to a GetObject operation when using Object Lambda
>>> Access Points. For information about Object Lambda Access Points, see 
>>> Transforming
>>> objects with Object Lambda Access Points
>>> 
>>>  in
>>> the *Amazon S3 User Guide*.
>>> This operation supports metadata that can be returned by GetObject
>>> ,
>>> in addition to RequestRoute, RequestToken, StatusCode, ErrorCode, and
>>> ErrorMessage. The GetObject response metadata is supported so that the
>>> WriteGetObjectResponse caller, typically an AWS Lambda function, can
>>> provide the same metadata when it internally invokes GetObject. When
>>> WriteGetObjectResponse is called by a customer-owned Lambda function,
>>> the metadata returned to the end user GetObject call might differ from
>>> what Amazon S3 would normally return.
>>
>> I am trying to find a workaround/mechanism to get this to work.
>>
>> Best,
>> Aniruddha
>> 
>>
>> ᐧ
>>
>> On Sun, Jun 27, 2021 at 5:52 PM Bill Ross  wrote:
>>
>>> Speaking from general server dev going back to the 90's, but w/o Amazon
>>> or Flask, so may not apply:
>>>
>>>
>>>- Jetty server now forwards the request to a Python Flask server
>>>which has the lambda function by passing object data to it
>>>- Lambda function code perform the transformation on the object and
>>>POST it back to Jetty server (which is a different API called
>>>writeGetObjectResponse)
>>>
>>> It seems the original GET should be waiting on a synchronous call to the
>>> Flask server (after the sync GET to 

Re: [jetty-users] Jakarta REST API Query

2021-06-27 Thread Bill Ross

Aniruddha,

How about e.g. (starting from retro code style I assume)

    @Override
    public void doGet(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException  {

    // get data from HS or HSC with synchronous GET

    // pass data to Lambda Server and get response synchronously

    // write data back

    }

In your case, the Lamda Server gets the data from HS/HSC synchronously, 
but the simple thing seems to be to return it from the Servlet thread 
handling the response, with no async steps along the way. The only 
reason for async that I can imagine is if jetty threads were very 
expensive somehow and couldn't waste time blocked on a request.


Bill


On 6/27/21 6:51 PM, Aniruddha Tekade via jetty-users wrote:

Bill,

Flask server only executes the lambda function (transforming the data 
-- ex. "my experiment with s3 object lambda".upper()) in python and 
then returns (or calls with) the transformed data in the body of 
response to write_get_object_response() defined with Java Server.

Best,
Aniruddha


ᐧ

On Sun, Jun 27, 2021 at 6:33 PM Bill Ross > wrote:


If the Flask server doesn't do synchronous responses, that would
explain my confusion. If it does, you may be misunderstanding me.

Bill

On 6/27/21 5:59 PM, Aniruddha Tekade via jetty-users wrote:

Yes, I can remove the flask server and use Jython instead to make
this run in the same Java server.
But since I am trying to reproduce what AWS does with S3 Object
Lambda


-

*WriteGetObjectResponse*

Passes
transformed objects to a |GetObject| operation when using
Object Lambda Access Points. For information about Object
Lambda Access Points, see Transforming objects with
Object Lambda Access Points


 in
the /Amazon S3 User Guide/.
This operation supports metadata that can be returned by
GetObject

,
in addition to |RequestRoute|, |RequestToken|,
|StatusCode|, |ErrorCode|, and |ErrorMessage|. The
|GetObject| response metadata is supported so that the
|WriteGetObjectResponse| caller, typically an AWS Lambda
function, can provide the same metadata when it
internally invokes |GetObject|. When
|WriteGetObjectResponse| is called by a customer-owned
Lambda function, the metadata returned to the end user
|GetObject| call might differ from what Amazon S3 would
normally return.

I am trying to find a workaround/mechanism to get this to work.

Best,
Aniruddha


ᐧ

On Sun, Jun 27, 2021 at 5:52 PM Bill Ross mailto:r...@cgl.ucsf.edu>> wrote:

Speaking from general server dev going back to the 90's, but
w/o Amazon or Flask, so may not apply:


  * Jetty server now forwards the request to a Python Flask
server which has the lambda function by passing object
data to it
  * Lambda function code perform the transformation on the
object and POST it back to Jetty server (which is a
different API called writeGetObjectResponse)


It seems the original GET should be waiting on a synchronous
call to the Flask server (after the sync GET to HS/HSC), and
respond by forwarding the response?



-- 
Phobrain.com

___
jetty-users mailing list
jetty-users@eclipse.org 
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jetty-users



___
jetty-users mailing list
jetty-users@eclipse.org  
To unsubscribe from this list, 
visithttps://www.eclipse.org/mailman/listinfo/jetty-users  

-- 
Phobrain.com

___
jetty-users mailing list
jetty-users@eclipse.org 
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jetty-users



___
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

--
Phobrain.com

Re: [jetty-users] Jakarta REST API Query

2021-06-27 Thread Aniruddha Tekade via jetty-users
Greg,

I think this can be helpful. Just to make sure I understand your point; do
you mean - give some ID to request on the flask side or before sending
request to flask i.e. on Jetty side?
Sorry for so trivial question but I have just started learning this hence
is a request for clarification.

Best,
Aniruddha


ᐧ

On Sun, Jun 27, 2021 at 7:03 PM Greg Wilkins  wrote:

> Aniruddha,
>
> sorry, but I have no knowledge of the s3 APIs etc.  All I'd say is that
> from an async API design point of view, there should always be some
> mechanism to allow you to associate an async response received with the
> request that you sent. There has got to be a way to either give some ID
> or get some ID to the request to Flask is obtainable from the results of
> the POST.
>
>
>
>
>
> On Mon, 28 Jun 2021 at 11:52, Aniruddha Tekade via jetty-users <
> jetty-users@eclipse.org> wrote:
>
>> Bill,
>>
>> Flask server only executes the lambda function (transforming the data --
>> ex. "my experiment with s3 object lambda".upper()) in python and then
>> returns (or calls with) the transformed data in the body of response to
>> write_get_object_response() defined with Java Server.
>> Best,
>> Aniruddha
>> 
>>
>> ᐧ
>>
>> On Sun, Jun 27, 2021 at 6:33 PM Bill Ross  wrote:
>>
>>> If the Flask server doesn't do synchronous responses, that would explain
>>> my confusion. If it does, you may be misunderstanding me.
>>>
>>> Bill
>>> On 6/27/21 5:59 PM, Aniruddha Tekade via jetty-users wrote:
>>>
>>> Yes, I can remove the flask server and use Jython instead to make this
>>> run in the same Java server.
>>> But since I am trying to reproduce what AWS does with S3 Object Lambda
>>> 
>>> -
>>>
>>> *WriteGetObjectResponse*

 Passes
 transformed objects to a GetObject operation when using Object Lambda
 Access Points. For information about Object Lambda Access Points, see 
 Transforming
 objects with Object Lambda Access Points
 
  in
 the *Amazon S3 User Guide*.
 This operation supports metadata that can be returned by GetObject
 ,
 in addition to RequestRoute, RequestToken, StatusCode, ErrorCode, and
 ErrorMessage. The GetObject response metadata is supported so that the
 WriteGetObjectResponse caller, typically an AWS Lambda function, can
 provide the same metadata when it internally invokes GetObject. When
 WriteGetObjectResponse is called by a customer-owned Lambda function,
 the metadata returned to the end user GetObject call might differ from
 what Amazon S3 would normally return.
>>>
>>> I am trying to find a workaround/mechanism to get this to work.
>>>
>>> Best,
>>> Aniruddha
>>> 
>>>
>>> ᐧ
>>>
>>> On Sun, Jun 27, 2021 at 5:52 PM Bill Ross  wrote:
>>>
 Speaking from general server dev going back to the 90's, but w/o Amazon
 or Flask, so may not apply:


- Jetty server now forwards the request to a Python Flask server
which has the lambda function by passing object data to it
- Lambda function code perform the transformation on the object and
POST it back to Jetty server (which is a different API called
writeGetObjectResponse)

 It seems the original GET should be waiting on a synchronous call to
 the Flask server (after the sync GET to HS/HSC), and respond by forwarding
 the response?



 --
 Phobrain.com
 ___
 jetty-users mailing list
 jetty-users@eclipse.org
 To unsubscribe from this list, visit
 https://www.eclipse.org/mailman/listinfo/jetty-users

>>>
>>> ___
>>> jetty-users mailing listjetty-us...@eclipse.org
>>> To unsubscribe from this list, visit 
>>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>>
>>> --
>>> Phobrain.com
>>> ___
>>> jetty-users mailing list
>>> jetty-users@eclipse.org
>>> To unsubscribe from this list, visit
>>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>>
>> ___
>> jetty-users mailing list
>> jetty-users@eclipse.org
>> To unsubscribe from this list, visit
>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>
>
>
> --
> Greg Wilkins  CTO http://webtide.com
>
___
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users


Re: [jetty-users] Jakarta REST API Query

2021-06-27 Thread Greg Wilkins
Aniruddha,

sorry, but I have no knowledge of the s3 APIs etc.  All I'd say is that
from an async API design point of view, there should always be some
mechanism to allow you to associate an async response received with the
request that you sent. There has got to be a way to either give some ID
or get some ID to the request to Flask is obtainable from the results of
the POST.





On Mon, 28 Jun 2021 at 11:52, Aniruddha Tekade via jetty-users <
jetty-users@eclipse.org> wrote:

> Bill,
>
> Flask server only executes the lambda function (transforming the data --
> ex. "my experiment with s3 object lambda".upper()) in python and then
> returns (or calls with) the transformed data in the body of response to
> write_get_object_response() defined with Java Server.
> Best,
> Aniruddha
> 
>
> ᐧ
>
> On Sun, Jun 27, 2021 at 6:33 PM Bill Ross  wrote:
>
>> If the Flask server doesn't do synchronous responses, that would explain
>> my confusion. If it does, you may be misunderstanding me.
>>
>> Bill
>> On 6/27/21 5:59 PM, Aniruddha Tekade via jetty-users wrote:
>>
>> Yes, I can remove the flask server and use Jython instead to make this
>> run in the same Java server.
>> But since I am trying to reproduce what AWS does with S3 Object Lambda
>> 
>> -
>>
>> *WriteGetObjectResponse*
>>>
>>> Passes
>>> transformed objects to a GetObject operation when using Object Lambda
>>> Access Points. For information about Object Lambda Access Points, see 
>>> Transforming
>>> objects with Object Lambda Access Points
>>> 
>>>  in
>>> the *Amazon S3 User Guide*.
>>> This operation supports metadata that can be returned by GetObject
>>> ,
>>> in addition to RequestRoute, RequestToken, StatusCode, ErrorCode, and
>>> ErrorMessage. The GetObject response metadata is supported so that the
>>> WriteGetObjectResponse caller, typically an AWS Lambda function, can
>>> provide the same metadata when it internally invokes GetObject. When
>>> WriteGetObjectResponse is called by a customer-owned Lambda function,
>>> the metadata returned to the end user GetObject call might differ from
>>> what Amazon S3 would normally return.
>>
>> I am trying to find a workaround/mechanism to get this to work.
>>
>> Best,
>> Aniruddha
>> 
>>
>> ᐧ
>>
>> On Sun, Jun 27, 2021 at 5:52 PM Bill Ross  wrote:
>>
>>> Speaking from general server dev going back to the 90's, but w/o Amazon
>>> or Flask, so may not apply:
>>>
>>>
>>>- Jetty server now forwards the request to a Python Flask server
>>>which has the lambda function by passing object data to it
>>>- Lambda function code perform the transformation on the object and
>>>POST it back to Jetty server (which is a different API called
>>>writeGetObjectResponse)
>>>
>>> It seems the original GET should be waiting on a synchronous call to the
>>> Flask server (after the sync GET to HS/HSC), and respond by forwarding the
>>> response?
>>>
>>>
>>>
>>> --
>>> Phobrain.com
>>> ___
>>> jetty-users mailing list
>>> jetty-users@eclipse.org
>>> To unsubscribe from this list, visit
>>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>>
>>
>> ___
>> jetty-users mailing listjetty-us...@eclipse.org
>> To unsubscribe from this list, visit 
>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>
>> --
>> Phobrain.com
>> ___
>> jetty-users mailing list
>> jetty-users@eclipse.org
>> To unsubscribe from this list, visit
>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>
> ___
> jetty-users mailing list
> jetty-users@eclipse.org
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-users
>


-- 
Greg Wilkins  CTO http://webtide.com
___
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users


Re: [jetty-users] Jakarta REST API Query

2021-06-27 Thread Aniruddha Tekade via jetty-users
Bill,

Flask server only executes the lambda function (transforming the data --
ex. "my experiment with s3 object lambda".upper()) in python and then
returns (or calls with) the transformed data in the body of response to
write_get_object_response() defined with Java Server.
Best,
Aniruddha


ᐧ

On Sun, Jun 27, 2021 at 6:33 PM Bill Ross  wrote:

> If the Flask server doesn't do synchronous responses, that would explain
> my confusion. If it does, you may be misunderstanding me.
>
> Bill
> On 6/27/21 5:59 PM, Aniruddha Tekade via jetty-users wrote:
>
> Yes, I can remove the flask server and use Jython instead to make this run
> in the same Java server.
> But since I am trying to reproduce what AWS does with S3 Object Lambda
> 
> -
>
> *WriteGetObjectResponse*
>>
>> Passes
>> transformed objects to a GetObject operation when using Object Lambda
>> Access Points. For information about Object Lambda Access Points, see 
>> Transforming
>> objects with Object Lambda Access Points
>> 
>>  in
>> the *Amazon S3 User Guide*.
>> This operation supports metadata that can be returned by GetObject
>> , in
>> addition to RequestRoute, RequestToken, StatusCode, ErrorCode, and
>> ErrorMessage. The GetObject response metadata is supported so that the
>> WriteGetObjectResponse caller, typically an AWS Lambda function, can
>> provide the same metadata when it internally invokes GetObject. When
>> WriteGetObjectResponse is called by a customer-owned Lambda function,
>> the metadata returned to the end user GetObject call might differ from
>> what Amazon S3 would normally return.
>
> I am trying to find a workaround/mechanism to get this to work.
>
> Best,
> Aniruddha
> 
>
> ᐧ
>
> On Sun, Jun 27, 2021 at 5:52 PM Bill Ross  wrote:
>
>> Speaking from general server dev going back to the 90's, but w/o Amazon
>> or Flask, so may not apply:
>>
>>
>>- Jetty server now forwards the request to a Python Flask server
>>which has the lambda function by passing object data to it
>>- Lambda function code perform the transformation on the object and
>>POST it back to Jetty server (which is a different API called
>>writeGetObjectResponse)
>>
>> It seems the original GET should be waiting on a synchronous call to the
>> Flask server (after the sync GET to HS/HSC), and respond by forwarding the
>> response?
>>
>>
>>
>> --
>> Phobrain.com
>> ___
>> jetty-users mailing list
>> jetty-users@eclipse.org
>> To unsubscribe from this list, visit
>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>
>
> ___
> jetty-users mailing listjetty-us...@eclipse.org
> To unsubscribe from this list, visit 
> https://www.eclipse.org/mailman/listinfo/jetty-users
>
> --
> Phobrain.com
> ___
> jetty-users mailing list
> jetty-users@eclipse.org
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-users
>
___
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users


Re: [jetty-users] Jakarta REST API Query

2021-06-27 Thread Aniruddha Tekade via jetty-users
Greg,

Yes, exactly this is what I am trying to solve. Your steps 1 - 4 are my
intended mechanism.

 it's a matter for the API talking to Flask, as you must be able to tunnel
> some id or other that will allow you to do the lookup at step 3.

My python client uses AWS boto3 session which makes a call to
s3_client.getObject(). My java server implements this getObject(). I tried
doing a getSessionId() on this but seems like its failing. How can I tunnel
an id here? Do you mean something using UUID?

Best,
Aniruddha



On Sun, Jun 27, 2021 at 6:32 PM Greg Wilkins  wrote:

>
>
> I'm a bit confused by your diagrams and descriptions.  Perhaps a simple
> interaction diagram would help?
>
> If it is just Client ---GET--> Jetty --GET--> Flask, then I'm not seeing
> the problem.  Just async wait for the response from Flask.
>
> But one of your diagrams/descriptions suggests that the sequence is:
>
>1. Jetty receives GET request from client
>2. Jetty sends GET request to Flask which competes
>3. Jetty receives POST request from  Flask, which needs to be matched
>to original GET from client
>4. Jetty sends response to original GET request
>
> Is this the case?   If so, then it's a matter for the API talking to
> Flask, as you must be able to tunnel some id or other that will allow you
> to do the lookup at step 3.
>
> Eitherway, a clearer description of the interaction and the issues you
> have would help.
>
>
>
>
>
>
>
>
> On Mon, 28 Jun 2021 at 11:00, Aniruddha Tekade via jetty-users <
> jetty-users@eclipse.org> wrote:
>
>> Yes, I can remove the flask server and use Jython instead to make this
>> run in the same Java server.
>> But since I am trying to reproduce what AWS does with S3 Object Lambda
>> 
>> -
>>
>> *WriteGetObjectResponse*
>>>
>>> Passes
>>> transformed objects to a GetObject operation when using Object Lambda
>>> Access Points. For information about Object Lambda Access Points, see 
>>> Transforming
>>> objects with Object Lambda Access Points
>>> 
>>>  in
>>> the *Amazon S3 User Guide*.
>>> This operation supports metadata that can be returned by GetObject
>>> ,
>>> in addition to RequestRoute, RequestToken, StatusCode, ErrorCode, and
>>> ErrorMessage. The GetObject response metadata is supported so that the
>>> WriteGetObjectResponse caller, typically an AWS Lambda function, can
>>> provide the same metadata when it internally invokes GetObject. When
>>> WriteGetObjectResponse is called by a customer-owned Lambda function,
>>> the metadata returned to the end user GetObject call might differ from
>>> what Amazon S3 would normally return.
>>
>> I am trying to find a workaround/mechanism to get this to work.
>>
>> Best,
>> Aniruddha
>> 
>>
>> ᐧ
>>
>> On Sun, Jun 27, 2021 at 5:52 PM Bill Ross  wrote:
>>
>>> Speaking from general server dev going back to the 90's, but w/o Amazon
>>> or Flask, so may not apply:
>>>
>>>
>>>- Jetty server now forwards the request to a Python Flask server
>>>which has the lambda function by passing object data to it
>>>- Lambda function code perform the transformation on the object and
>>>POST it back to Jetty server (which is a different API called
>>>writeGetObjectResponse)
>>>
>>> It seems the original GET should be waiting on a synchronous call to the
>>> Flask server (after the sync GET to HS/HSC), and respond by forwarding the
>>> response?
>>>
>>>
>>>
>>> --
>>> Phobrain.com
>>> ___
>>> jetty-users mailing list
>>> jetty-users@eclipse.org
>>> To unsubscribe from this list, visit
>>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>>
>> ___
>> jetty-users mailing list
>> jetty-users@eclipse.org
>> To unsubscribe from this list, visit
>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>
>
>
> --
> Greg Wilkins  CTO http://webtide.com
> ___
> jetty-users mailing list
> jetty-users@eclipse.org
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-users
>
ᐧ
___
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users


Re: [jetty-users] Jakarta REST API Query

2021-06-27 Thread Bill Ross
If the Flask server doesn't do synchronous responses, that would explain 
my confusion. If it does, you may be misunderstanding me.


Bill

On 6/27/21 5:59 PM, Aniruddha Tekade via jetty-users wrote:
Yes, I can remove the flask server and use Jython instead to make this 
run in the same Java server.
But since I am trying to reproduce what AWS does with S3 Object Lambda 
 
-


*WriteGetObjectResponse*

Passes
transformed objects to a |GetObject| operation when using
Object Lambda Access Points. For information about Object
Lambda Access Points, see Transforming objects with Object
Lambda Access Points


 in
the /Amazon S3 User Guide/.
This operation supports metadata that can be returned by
GetObject
,
in addition to |RequestRoute|, |RequestToken|, |StatusCode|,
|ErrorCode|, and |ErrorMessage|. The |GetObject| response
metadata is supported so that the
|WriteGetObjectResponse| caller, typically an AWS Lambda
function, can provide the same metadata when it internally
invokes |GetObject|. When |WriteGetObjectResponse| is called
by a customer-owned Lambda function, the metadata returned to
the end user |GetObject| call might differ from what Amazon S3
would normally return.

I am trying to find a workaround/mechanism to get this to work.

Best,
Aniruddha


ᐧ

On Sun, Jun 27, 2021 at 5:52 PM Bill Ross > wrote:


Speaking from general server dev going back to the 90's, but w/o
Amazon or Flask, so may not apply:


  * Jetty server now forwards the request to a Python Flask
server which has the lambda function by passing object data to it
  * Lambda function code perform the transformation on the object
and POST it back to Jetty server (which is a different API
called writeGetObjectResponse)


It seems the original GET should be waiting on a synchronous call
to the Flask server (after the sync GET to HS/HSC), and respond by
forwarding the response?



-- 
Phobrain.com

___
jetty-users mailing list
jetty-users@eclipse.org 
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jetty-users



___
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

--
Phobrain.com
___
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users


Re: [jetty-users] Jakarta REST API Query

2021-06-27 Thread Greg Wilkins
I'm a bit confused by your diagrams and descriptions.  Perhaps a simple
interaction diagram would help?

If it is just Client ---GET--> Jetty --GET--> Flask, then I'm not seeing
the problem.  Just async wait for the response from Flask.

But one of your diagrams/descriptions suggests that the sequence is:

   1. Jetty receives GET request from client
   2. Jetty sends GET request to Flask which competes
   3. Jetty receives POST request from  Flask, which needs to be matched to
   original GET from client
   4. Jetty sends response to original GET request

Is this the case?   If so, then it's a matter for the API talking to Flask,
as you must be able to tunnel some id or other that will allow you to do
the lookup at step 3.

Eitherway, a clearer description of the interaction and the issues you have
would help.








On Mon, 28 Jun 2021 at 11:00, Aniruddha Tekade via jetty-users <
jetty-users@eclipse.org> wrote:

> Yes, I can remove the flask server and use Jython instead to make this run
> in the same Java server.
> But since I am trying to reproduce what AWS does with S3 Object Lambda
> 
> -
>
> *WriteGetObjectResponse*
>>
>> Passes
>> transformed objects to a GetObject operation when using Object Lambda
>> Access Points. For information about Object Lambda Access Points, see 
>> Transforming
>> objects with Object Lambda Access Points
>> 
>>  in
>> the *Amazon S3 User Guide*.
>> This operation supports metadata that can be returned by GetObject
>> , in
>> addition to RequestRoute, RequestToken, StatusCode, ErrorCode, and
>> ErrorMessage. The GetObject response metadata is supported so that the
>> WriteGetObjectResponse caller, typically an AWS Lambda function, can
>> provide the same metadata when it internally invokes GetObject. When
>> WriteGetObjectResponse is called by a customer-owned Lambda function,
>> the metadata returned to the end user GetObject call might differ from
>> what Amazon S3 would normally return.
>
> I am trying to find a workaround/mechanism to get this to work.
>
> Best,
> Aniruddha
> 
>
> ᐧ
>
> On Sun, Jun 27, 2021 at 5:52 PM Bill Ross  wrote:
>
>> Speaking from general server dev going back to the 90's, but w/o Amazon
>> or Flask, so may not apply:
>>
>>
>>- Jetty server now forwards the request to a Python Flask server
>>which has the lambda function by passing object data to it
>>- Lambda function code perform the transformation on the object and
>>POST it back to Jetty server (which is a different API called
>>writeGetObjectResponse)
>>
>> It seems the original GET should be waiting on a synchronous call to the
>> Flask server (after the sync GET to HS/HSC), and respond by forwarding the
>> response?
>>
>>
>>
>> --
>> Phobrain.com
>> ___
>> jetty-users mailing list
>> jetty-users@eclipse.org
>> To unsubscribe from this list, visit
>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>
> ___
> jetty-users mailing list
> jetty-users@eclipse.org
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-users
>


-- 
Greg Wilkins  CTO http://webtide.com
___
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users


Re: [jetty-users] Jakarta REST API Query

2021-06-27 Thread Aniruddha Tekade via jetty-users
Yes, I can remove the flask server and use Jython instead to make this run
in the same Java server.
But since I am trying to reproduce what AWS does with S3 Object Lambda

-

*WriteGetObjectResponse*
>
> Passes
> transformed objects to a GetObject operation when using Object Lambda
> Access Points. For information about Object Lambda Access Points, see 
> Transforming
> objects with Object Lambda Access Points
> 
>  in
> the *Amazon S3 User Guide*.
> This operation supports metadata that can be returned by GetObject
> , in
> addition to RequestRoute, RequestToken, StatusCode, ErrorCode, and
> ErrorMessage. The GetObject response metadata is supported so that the
> WriteGetObjectResponse caller, typically an AWS Lambda function, can
> provide the same metadata when it internally invokes GetObject. When
> WriteGetObjectResponse is called by a customer-owned Lambda function, the
> metadata returned to the end user GetObject call might differ from what
> Amazon S3 would normally return.

I am trying to find a workaround/mechanism to get this to work.

Best,
Aniruddha


ᐧ

On Sun, Jun 27, 2021 at 5:52 PM Bill Ross  wrote:

> Speaking from general server dev going back to the 90's, but w/o Amazon or
> Flask, so may not apply:
>
>
>- Jetty server now forwards the request to a Python Flask server which
>has the lambda function by passing object data to it
>- Lambda function code perform the transformation on the object and
>POST it back to Jetty server (which is a different API called
>writeGetObjectResponse)
>
> It seems the original GET should be waiting on a synchronous call to the
> Flask server (after the sync GET to HS/HSC), and respond by forwarding the
> response?
>
>
>
> --
> Phobrain.com
> ___
> jetty-users mailing list
> jetty-users@eclipse.org
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-users
>
___
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users


Re: [jetty-users] Jakarta REST API Query

2021-06-27 Thread Bill Ross
Speaking from general server dev going back to the 90's, but w/o Amazon 
or Flask, so may not apply:


# Jetty server now forwards the request to a Python Flask server which 
has the lambda function by passing object data to it
# Lambda function code perform the transformation on the object and POST 
it back to Jetty server (which is a different API called 
writeGetObjectResponse)


It seems the original GET should be waiting on a synchronous call to the 
Flask server (after the sync GET to HS/HSC), and respond by forwarding 
the response?




--
Phobrain.com
___
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users