Is TaskId restricted to Ulid by design? #748
Unanswered
realonbebeto
asked this question in
Q&A
Replies: 7 comments 7 replies
|
TaskId implements FromStr you need to use that. |
0 replies
|
Well, then implication for that is that TaskId must always be Ulid for PG. Is it extensible to use an alternative string, uuid, serial? |
0 replies
|
No, because PG uses the Ulid to order jobs.
…On Thu, 28 May 2026, 16:05 Bebeto Nyamwamu, ***@***.***> wrote:
Well, then implication for that is that TaskId must always be Ulid for PG.
Is it extensible to use an alternative string, uuid, serial?
—
Reply to this email directly, view it on GitHub
<#748?email_source=notifications&email_token=AWXVRGW3PKGXMMMOX5M65PT45A2S5A5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNZQHEYTCOJZUZZGKYLTN5XKOY3PNVWWK3TUUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#discussioncomment-17091199>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWXVRGTQ5DXGEKIM7BVBOVT45A2S5AVCNFSM6AAAAACZPPGX7SVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTOMBZGEYTSOI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
1 reply
|
If you are trying to attach a unique string to a task use idepondency_key
…On Thu, 28 May 2026, 16:16 Bebeto Nyamwamu, ***@***.***> wrote:
Sure. Thank you.
—
Reply to this email directly, view it on GitHub
<#748?email_source=notifications&email_token=AWXVRGRX4TXLFIVRXOGQS6D45A32LA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNZQHEYTGNBRUZZGKYLTN5XKOY3PNVWWK3TUUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#discussioncomment-17091341>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWXVRGVFLSJFFPDDAHMPH3D45A32LAVCNFSM6AAAAACZPPGX7SVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTOMBZGEZTIMI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
2 replies
|
The approach is usually you generate an Id, use with_task_id. Sinks in rust
return a unit. You can also use an sql query if you need to be fine grained
…On Thu, 28 May 2026 at 17:09, Bebeto Nyamwamu ***@***.***> wrote:
Very much aware of that. Thank you. The reason to think I can have an
extensible TaskId is this trait FetchById.
How would you know the TaskId if you dont assign it when pushing the tasks
to the backend?
—
Reply to this email directly, view it on GitHub
<#748?email_source=notifications&email_token=AWXVRGXKJYBJZCIIOFFFV3T45BCC7A5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNZQHEZDCOJSUZZGKYLTN5XKOY3PNVWWK3TUUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#discussioncomment-17092192>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWXVRGSEMPDNJZV6RGRPEW345BCC7AVCNFSM6AAAAACZPPGX7SVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTOMBZGIYTSMQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
1 reply
|
You should be able to convert Ulid to Uuid
…On Thu, 28 May 2026, 17:22 Bebeto Nyamwamu, ***@***.***> wrote:
Thats the correct 👌 approach with using with_task_id but then as you
mentioned there is a design constraint of Ulid (thinking out loud is if
this can be flexible to other id types so that if someone is using uuids
they can use that instead of having an extra dependency) by PG to order
jobs.
—
Reply to this email directly, view it on GitHub
<#748?email_source=notifications&email_token=AWXVRGQGEJO77VJAWEQ3RKD45BDRNA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNZQHEZDIMJXUZZGKYLTN5XKOY3PNVWWK3TUUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#discussioncomment-17092417>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWXVRGUMKCTI6JT53QHAFBL45BDRNAVCNFSM6AAAAACZPPGX7SVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTOMBZGI2DCNY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
3 replies
|
It should throw a conflict error.
https://docs.rs/apalis-postgres/latest/src/apalis_postgres/sink.rs.html#137
…On Sat, 6 Jun 2026 at 04:24, Bebeto Nyamwamu ***@***.***> wrote:
@geofmureithi <https://github.com/geofmureithi> What is the intended
outcome when using the idepondency_key and the same job is submitted twice?
Should an error be triggered, an update is made to the job or just ignored?
—
Reply to this email directly, view it on GitHub
<#748?email_source=notifications&email_token=AWXVRGRSR62JMQDJCEW2HVT46NXFPA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNZRHE4TCOJZUZZGKYLTN5XKO3LFNZ2GS33OUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#discussioncomment-17199199>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWXVRGUULKUFYMLAEUMPFN346NXFPAVCNFSM6AAAAACZPPGX7SVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTOMJZHEYTSOI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I have been toying with apalis-postgres to push tasks to the backend as follows:
`
let backend: PostgresStorage = PostgresStorage::new(&pool);
let task = TaskBuilder::new(v)
.with_task_id(TaskId::new(tx_id.to_string())).build
backend.push_task(task).await?;`
The following is the error am encountering:
= expected struct
apalis::prelude::Task<_, SqlContext<Pool<Postgres>>, Ulid>found struct
apalis::prelude::Task<_, _, std::string::String>Going by the source code:
apalis/apalis-core/src/task/task_id.rs
Line 87 in 60b0d69
All reactions