Skip to content
\n

Is it somehow possible to get the message_id that will be later echoed as receipted_message_id at this point?
\nI know that I can use the following listener:

\n
client.set_message_sent_handler(\n    lambda pdu: logger.debug(f\"sent {pdu.message_id}\")\n)
\n

But I cannot know if the message_id is the message id for the message I just sent in a multi-threaded environment 🤔

","upvoteCount":1,"answerCount":5,"acceptedAnswer":{"@type":"Answer","text":"

I resolved the issue by entering a lock when sending an SMS and releasing it when all parts can be associated with a message_id provided by the set_message_sent_handler. The time we are waiting is neglectable as the handler is usually called before the second part of the message is processed.

","upvoteCount":2,"url":"https://github.com/python-smpplib/python-smpplib/discussions/246#discussioncomment-8047949"}}}
Discussion options

You must be logged in to vote

I resolved the issue by entering a lock when sending an SMS and releasing it when all parts can be associated with a message_id provided by the set_message_sent_handler. The time we are waiting is neglectable as the handler is usually called before the second part of the message is processed.

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by eigenein
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #245 on January 08, 2024 11:32.