Skip to content
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

Add possibility to add message_id through actor.send() #298

Open
m2cci-MZL opened this issue May 25, 2022 · 2 comments
Open

Add possibility to add message_id through actor.send() #298

m2cci-MZL opened this issue May 25, 2022 · 2 comments

Comments

@m2cci-MZL
Copy link

Hello,
Is it nice to have the possibility to specify the message_id while using an actor, is it possible?

@remoulade.actor
def count_words(url):
response = requests.get(url)
count = len(response.text.split(" "))
print(f"There are {count} words at {url!r}.")

remoulade.declare_actors([count_words])

count_words("www.example.com", message_id=my_message_id)

@antoinerabany
Copy link
Member

Hello,

it's not possible at the moment, I guess it could be. What is your use case ?

@m2cci-MZL
Copy link
Author

This is very usefullwhile debugging, when using local broker, things are synchronous
the usecase in summary is using the actor asynchronously, then adding an object to a database, this object should be identified with the message id.
While processing the task of the actor, I'd like to change the database object (in my case i'm using sqlalchemy).
The problem is when I'm trying to manipulate my object in my task, the database object isn't yet created (because I need the message id for that)
to sum up:
Generate a message id -> start task with this message id -> add object to database with this unique message id -> manipulating this object in the task previously started

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants