4 years ago

Jobs, Events & Listeners

Posted 4 years ago by cristian9509

I am trying to wrap my head around these concepts. I understand a bit the workflow but I would love some input, as to when, which and why to use.

So here is an example: User registers and then will need to create a Stripe Subscription.

User registration: I will need to create a user (CreateUser) here and then send them an welcome email (SendWelcomeEmail)

StripeSubscription: Here I will need to do multiple things. When a user first signs up with my app I would need to create a new subscription with Stripe (CreateNewSubscription). Later if they want to change something to their subscription they can cancel (CancelSubscription), resume a cancelled but on grace period subscription (ResumeSubscription) or reactivate a cancelled and expired subscription (ReactivateSubscription). All these actions done by the user would also require that I send them emails based on the action they took.

What should be done by a Job and what should be done by an Event?

Jobs: UserCreate, SubscriptionCreate, SubscriptionCancel, SubscriptionCancel, SubscriptionReactivate? Events: emailUserCreate, emailSubscriptionCreate, etc?

Please sign in or create an account to participate in this conversation.