Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jakarta REST API Query

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 <ross@xxxxxxxxxxxx> 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 RequestRouteRequestTokenStatusCodeErrorCode, 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 <ross@xxxxxxxxxxxx> 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@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

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

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

Back to the top