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 order-worker. #11

Merged
merged 1 commit into from
Apr 4, 2024
Merged

Add order-worker. #11

merged 1 commit into from
Apr 4, 2024

Conversation

robholland
Copy link
Collaborator

No description provided.

Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just slight filename suggestion

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main.go would be the consistent name for this file with the other cmd

)

var rootCmd = &cobra.Command{
Use: "order-worker",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to change anything, but can get a bit confusing calling this "order" worker that does "order" and "shipment" stuff. I think there is ambiguity on whether "order" means "order" things in code or the general name of the app/worker.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Paul, Rob, and I discussed this. We agree with the comment, but feel that it's probably a short-term issue, as the single Worker will likely be split into more specialized Workers later (e.g., one for Orders and another for Shipments). If that doesn't happen before release, then we'll find a better name for this one.

Use: "order-worker",
Short: "Worker for Order system",
Run: func(cmd *cobra.Command, args []string) {
c, err := client.Dial(client.Options{})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't have to be now, but at some point we're going to want people to be able to configure their endpoint externally (i.e. ability to run reference app against cloud)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cretz What would you recommend as being the most convenient way to do that? Through environment variables, for example? If so, I can certainly update the code to do that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are actually exploring this as a general feature need for Temporal at temporalio/features#441. In the meantime, anything is probably ok (e.g. env vars is fine).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan to submit a PR that updates it to use environment variables. I'll use the same as those already used by the Temporal CLI, for consistency.

Copy link
Collaborator

@tomwheeler tomwheeler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I ran the code successfully and was able to manually process both a single shipment and an order with multiple shipments.

I do agree with Chad that the naming is slightly confusing, since this Worker handles both Order and Shipment Workflows.

I also agree that renaming the file from worker.go to main.go would make it more consistent with this example as well as other Go examples that Temporal provides (such as those in the samples-go repository). The naming of the parent directory already conveys that this is a Worker.

Use: "order-worker",
Short: "Worker for Order system",
Run: func(cmd *cobra.Command, args []string) {
c, err := client.Dial(client.Options{})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cretz What would you recommend as being the most convenient way to do that? Through environment variables, for example? If so, I can certainly update the code to do that.

)

var rootCmd = &cobra.Command{
Use: "order-worker",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Paul, Rob, and I discussed this. We agree with the comment, but feel that it's probably a short-term issue, as the single Worker will likely be split into more specialized Workers later (e.g., one for Orders and another for Shipments). If that doesn't happen before release, then we'll find a better name for this one.

Use: "order-worker",
Short: "Worker for Order system",
Run: func(cmd *cobra.Command, args []string) {
c, err := client.Dial(client.Options{})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan to submit a PR that updates it to use environment variables. I'll use the same as those already used by the Temporal CLI, for consistency.

@tomwheeler tomwheeler merged commit c8a5ff5 into main Apr 4, 2024
2 checks passed
@robholland robholland deleted the order-worker branch April 19, 2024 15:19
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

Successfully merging this pull request may close these issues.

3 participants