Skip to content

Proper Client Use and Configuration for Scale #564

Answered by ymwjbxxq
eblackw2 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

Inside the main function you should initialize the client;

#[tokio::main]
async fn main() -> Result<(), Error> {
   let sqs_client = aws_sdk_sqs::Client::new(&config);
   let app_client = MyDIStruct::builder()
            .sqs_client(sqs_client)
            .build();

    lambda_http::run(service_fn(|event: Request| {
        my_handler(&app_client, event)
    })).await?;
    Ok(())
}

and now you can pass it to the handler and you use it from there.

About SQS:

  • If you have many messages I would say use the send_message_batch for better latency.
  • If you need to use the send_message I got throttled but sending thousands at the same time (different runtime)

About Latency:
you can setup …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@eblackw2
Comment options

@ymwjbxxq
Comment options

Answer selected by jmklix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants