-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better dynamic runtime queue selection support #11
Comments
@prabirshrestha
I haven't thought about this. In our codebase, However, |
It is a bummer that it wouldn't work. In the mean time I have opened launchbadge/sqlx#2162. let queue: AnyQueue = match anypool.any_kind() {
AnyKind::Postgres => PostgresQueue::with_pool(any_pool.try_into().unwrap()).into(),
AnyKind::Sqlite => SqliteQueue::with_pool(any_pool.try_into().unwrap()).into();
} Might be similar like sqlx, instead of having generic Queue, it should have |
Yeah, I think having a AnyQueue is a reasonable way to go. Ideally there
will be a macro that can generate AnyQueue and AnyJobHandler style enums
with queues you want to support instead of a single "official" one.
In the end we want to support backends beyond what sqlx supports: Redis,
NATS, Kafka, etc. it's just currently our internal need is just SQLite with
PostgreSQL on the horizon.
…On Wed, Oct 19, 2022, 8:56 PM Prabir Shrestha ***@***.***> wrote:
It is a bummer that it wouldn't work. In the mean time I have opened
launchbadge/sqlx#2162 <launchbadge/sqlx#2162>.
let queue: AnyQueue = match anypool.any_kind() {
AnyKind::Postgres => PostgresQueue::with_pool(any_pool.try_into().unwrap()).into(),
AnyKind::Sqlite => SqliteQueue::with_pool(any_pool.try_into().unwrap()).into();}
Might be similar like sqlx, instead of having generic Queue, it should
have AnyQueue? For those that want to support multiple they would use
AnyQueue and they can always go back to PostgresQueue or SqliteQueue if
they need more control.
—
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABEFG6PYB734IH3WORZODLWEC7G7ANCNFSM6AAAAAARIVKELY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
My app choose dynamically between sqlite and postgres. Is it possible to support
AnyPool
from sqlx instead of using onlySqlitePool
forSqliteQueue::with_pool(anypool)
?I would also like to store queue in struct but it currently requires specifying
JobHandle
?For now it doesn't matter much since aide-de-camp only supports sqlite, but would like to make it work for generic cases where I can easily swap the queue.
The text was updated successfully, but these errors were encountered: