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

implement HTTP target capability and connector handler #14491

Merged
merged 12 commits into from
Sep 26, 2024

Conversation

jinhoonbang
Copy link
Contributor

@jinhoonbang jinhoonbang commented Sep 19, 2024

  • implement HTTP target capability that makes outbound HTTP calls via the gateway. It supports SingleNode mode, which forwards HTTP calls via the first available gateway. This is done through a new SignAndSendToGateway() method in the gateway connector that selects an available gateway and signs the request before sending it to the gateway
  • implement connector handler that receives response from the gateway and sychronously returns gateway response to capability.Execute()
  • corresponding changes for the gateway (e.g. http client for outgoing message and gateway handler) will be done in a separate PR

JIRA: https://smartcontract-it.atlassian.net/browse/CM-469
Doc: https://docs.google.com/document/d/19PvTwosdwqNztwP6vcXSdt_s81xZXpjKU-5bpwhsd2M/edit#heading=h.4e7ng0tekbkc

@jinhoonbang jinhoonbang marked this pull request as ready for review September 19, 2024 20:53
@jinhoonbang jinhoonbang requested a review from a team as a code owner September 19, 2024 20:53
type WorkflowConfig struct {
TimeoutMs uint32 `json:"timeoutMs,omitempty"` // Timeout in milliseconds
RetryCount uint8 `json:"retryCount,omitempty"` // Number of retries, defaults to 0.
Schedule string `json:"schedule,omitempty"` // schedule, defaults to empty.
Copy link
Contributor

Choose a reason for hiding this comment

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

Description doesn't say what this is.
Also, nit: not sure if schedule is the most accurate name for this. More like a strategy/type/method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

how about DeliveryMode ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that sounds good

}

func NewCapability(config Config, registry core.CapabilitiesRegistry, connectorHandler *ConnectorHandler, lggr logger.Logger) (*Capability, error) {
return &Capability{
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: only fix if doing other fixes, but how about validating some of the fields? Says connectorHandler is nil?

return capabilities.CapabilityResponse{}, err
}

// TODO: check target response format and fields
Copy link
Contributor

Choose a reason for hiding this comment

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

still a todo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep linked a JIRA ticket


func (c *Capability) RegisterToWorkflow(ctx context.Context, req capabilities.RegisterToWorkflowRequest) error {
// Workflow engine guarantees registration requests are valid
// TODO: handle retry configuration
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: link to jira that will resolve the todo.

Copy link
Contributor

@justinkaseman justinkaseman left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

5 participants