Discussion started here elixir-broadway/broadway#68.
@gvaughn:
Will I have to write a custom Producer to make this possible? Maybe with just a custom SqsClient?
Currently, the only option would be to create a custom SQSClient. However, we believe it would be a good idea to extend the API to allow this, so here's is a first suggestion:
We can provide a new config option for the client called token_generator, which is a {M, f, a} to be called before each receive/delete request. An initial implementation of this generator could be a GenServer that periodically updates the token (maybe on an :ets table with read_concurrency: true?).
In case you see other scenarios where we might need to update other config options, we could even consider expanding this concept to a more generic one like extra_options_generator that could be used to merge any other option to the config.
Thoughts?
Discussion started here elixir-broadway/broadway#68.
@gvaughn:
Currently, the only option would be to create a custom SQSClient. However, we believe it would be a good idea to extend the API to allow this, so here's is a first suggestion:
We can provide a new config option for the client called
token_generator, which is a{M, f, a}to be called before each receive/delete request. An initial implementation of this generator could be aGenServerthat periodically updates the token (maybe on an:etstable withread_concurrency: true?).In case you see other scenarios where we might need to update other config options, we could even consider expanding this concept to a more generic one like
extra_options_generatorthat could be used to merge any other option to the config.Thoughts?