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

chore(engine, engine-rest): Add CreateTime Flag to Fetch and Lock API #3912

Merged
merged 22 commits into from
Dec 13, 2023

Conversation

psavidis
Copy link
Contributor

@psavidis psavidis commented Nov 3, 2023

  • Fetch & Lock API Changes

Related-to: #3896

@psavidis psavidis self-assigned this Nov 3, 2023
@psavidis psavidis changed the title 3896 fetch and lock chore(engine, engine-rest): Add CreationDate Flag to Fetch and Lock API Nov 3, 2023
@psavidis psavidis force-pushed the 3896-fetch-and-lock branch from f8b516f to 2f9d5cf Compare November 3, 2023 17:45
@psavidis psavidis force-pushed the 3896-persistence-layer-adjustments branch from 1b98f18 to 70c15f8 Compare November 6, 2023 16:43
@psavidis psavidis force-pushed the 3896-fetch-and-lock branch 2 times, most recently from 28c90fd to 9eb9fe4 Compare November 6, 2023 17:18
@psavidis psavidis changed the title chore(engine, engine-rest): Add CreationDate Flag to Fetch and Lock API chore(engine, engine-rest): Add CreateTime Flag to Fetch and Lock API Nov 6, 2023
@psavidis psavidis requested a review from mboskamp November 6, 2023 17:20
@psavidis psavidis marked this pull request as ready for review November 7, 2023 07:20
@psavidis psavidis added the ci:all-db Runs the builds for all databases. label Nov 7, 2023
@psavidis psavidis force-pushed the 3896-persistence-layer-adjustments branch 3 times, most recently from 99cb039 to e278542 Compare November 7, 2023 22:28
@psavidis psavidis force-pushed the 3896-fetch-and-lock branch from 6edea26 to ccf8675 Compare November 7, 2023 22:36
- MyBatis Adjustments
- ExternalTask is saved & Creation Date is persisted
- orderByCreationDate works with ASC & DESC Order
- HistoryExternalTaskLog uses creation date
@psavidis psavidis force-pushed the 3896-persistence-layer-adjustments branch from e278542 to 6a8919c Compare November 9, 2023 16:06
- Add parameter useCreationDate to ExternalTaskService
- The parameter passes-through until FetchExternalTasksCmd where it is not currently utilized
Adjust test usage of externalTaskService#fetchAndLock to use `useCreationDate` with false value
- Configuring creationDate fro ExternalTaskService#fetchAndLock is performed using `CreationDateConfig` enum
- ExternalTaskRestService uses `CreationDateConfig` DTO to pass direction and enablement /disablement of `useCreationDate` param
- Unit Tests for creationDate DESC, ASC order using ExternalTaskService

- Pending are the multi-level sorting tests for both priority and creationDate
- Remove Tests and rewrite them:

testFetchWithCreationDateASC
testFetchWithCreationDateDESC

Replaced by:

shouldFetchWithCreationDateDESCWithoutPriority
shouldFetchWithCreationDateASCWithoutPriority

- Externalise CreationDate to `LockedExternalTaskImpl`
@psavidis psavidis force-pushed the 3896-fetch-and-lock branch from 5d7a359 to 05e9de6 Compare November 9, 2023 16:11
Copy link
Member

@mboskamp mboskamp left a comment

Choose a reason for hiding this comment

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

As discussed: There already is a generic sorting mechanism for query APIs that we can use for the fetch and lock sorting as well.

@psavidis psavidis force-pushed the 3896-fetch-and-lock branch from 021e508 to c7df2d7 Compare November 14, 2023 16:29
- Apply Code Review points
- Use Sortings for fetch And Lock API
@psavidis psavidis force-pushed the 3896-fetch-and-lock branch from c7df2d7 to 5033882 Compare November 15, 2023 07:33
Refactor FetchAndLockBuilder not to extend ExternalTaskQueryTopicBuilder but rather return it
- Fix constructors to initialize internally dependencies that do not belong outside their scope
- ExternalTaskQueryTopicBuilderImpl copy constructor copies currentInstruction
- Add tests that verify the parameter propagation from the DTO to the builder and the correct invocation
- Add validations to the FetchAndLockBuilderImpl similar to the QueryAPI for ensuring the correct method invocation on the sorting field and the order
@psavidis psavidis requested a review from tasso94 November 20, 2023 08:09
Copy link
Member

@mboskamp mboskamp left a comment

Choose a reason for hiding this comment

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

This already looks very good. I added some smaller hints. I have one more concern about the design of the external task builders that I would like to talk to you about synchronously if you are up for it. I left some comments already, but only on some affected lines. I also did not look too much at the tests yet.

@psavidis psavidis requested a review from tasso94 November 30, 2023 14:59
@psavidis psavidis force-pushed the 3896-fetch-and-lock branch 2 times, most recently from 3818ff3 to cea05c6 Compare December 1, 2023 14:23
- Remove execute method from FetchAndLockBuilder
- Refactor FetchAndLockBuilderImpl to use a List instead of a Map and make it similar to the QueryAPI for the sake of consistency
- Add tests for covering invalid usages of fetchAndLock API
- Infer useCreateTime
- Correct JavaDoc
- Generify Sorting of FetchAndLock Impl
- Remove var
@psavidis psavidis force-pushed the 3896-fetch-and-lock branch from cea05c6 to c50657a Compare December 1, 2023 14:57
Copy link
Member

@mboskamp mboskamp left a comment

Choose a reason for hiding this comment

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

Thanks for your effort. I only spotted some minor things. Nice job implementing all the suggestions so far.

- Enrich comments
- Use AssertJ Sort Asertion
- Move when / then blocks
- Reset Clock on TearDown
- Apply Suggestions
- Remove unnecessary method
- Refactor
- Comments
@psavidis psavidis requested a review from mboskamp December 12, 2023 09:40
- Enhancements in ExternalTaskManager
- Remove usePriority instance field
- Enhance orderingProperties check
Copy link
Member

@mboskamp mboskamp left a comment

Choose a reason for hiding this comment

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

🚀🚀🚀 Great job @psavidis! This is a nice feature.

@psavidis psavidis merged commit 159d401 into 3896-feature Dec 13, 2023
2 of 4 checks passed
@psavidis psavidis deleted the 3896-fetch-and-lock branch December 13, 2023 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:all-db Runs the builds for all databases.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants