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

Refactor to allow customization of conductor client library #248

Conversation

maggopensrc
Copy link

The HTTP facing element of conductor client is refactored to allow effective customization. Also, supplying of http headers (as simple as an auth token when required) is taken care with providing defaults and hence with no changes in behavior.

Pull Request type

  • Bugfix
  • Feature
  • [✓] Refactoring (no functional changes, no api changes)
  • Build related changes
  • WHOSUSING.md
  • Other (please describe):

NOTE: Please remember to run ./gradlew spotlessApply to fix any format violations.

Changes in this PR

The HTTP facing element of conductor client is refactored to allow effective customization. Also, supplying of http headers (as simple as an auth token when required) is taken care with providing defaults and hence with no changes in behavior.

The HTTP facing element of conductor client is refactored to allow effective customization.
Also, supplying of http headers (as simple as an auth token when required) is taken care with
providing defaults and hence with no changes in behavior.
@jmigueprieto
Copy link
Contributor

Hi @maggopensrc - thank you for submitting this PR.

We cannot merge it due to conflicts and the fact that tests are failing.

Also, I would like to better understand how you intend to use these changes. I have 2 concerns/question.

(1)

This PR is in fact changing the API of different clients. Not the public API but it's exposing a protected methods.

In MetadataClient I see something like:

protected void registerWorkflowDef(WorkflowDef workflowDef, Map<String, Object> headers) {
   Validate.notNull(workflowDef, "Workflow definition cannot be null");
   postForEntityWithRequestOnly("metadata/workflow", headers, workflowDef);
}

I understand this is an invitation to use inheritance to use these methods. I'm not very fond of that idea and mixing headers with with a domain object (WorkflowDef in this case) can be seen as a violation of separation of concerns.

Is this the intended usage?

(2)

If you want to supply an auth token or other headers you have the option of filters e.g.: https://github.com/orkes-io/orkes-conductor-client/blob/0.2.0/src/main/java/io/orkes/conductor/client/http/auth/AuthorizationClientFilter.java

Maybe there is a valid use case for this other than auth headers, could you please share it to consider if we should move forward with this PR.

Last but not least, a new version of the client is going to be published soon which makes it even easier to add headers to requests.

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.

2 participants