Skip to content

feat: strategy delay #1591 - #1738

Merged
lbroudoux merged 7 commits into
microcks:1.13.xfrom
SebastienDegodez:feature/1591-strategy-delay
Sep 24, 2025
Merged

lbroudoux merged 7 commits into
microcks:1.13.xfrom
SebastienDegodez:feature/1591-strategy-delay

Conversation

@SebastienDegodez

@SebastienDegodez SebastienDegodez commented Sep 12, 2025 •

Copy link
Copy Markdown
Member

Description

  • Allows specifying the strategy with the x-microcks-delay-strategy header. (3 values: fixed, random and random-xx)
  • Introduced DelaySpec record / value object encapsulating delay value and strategy
  • Added DelayApplier interface and implementations (Fixed, Random, RandomRanged)
  • Implemented DelayApplierFactory for controlled instantiation
  • Refactored controllers and MetadataExtractor to use DelaySpec (record)
  • Preserved flat persistence structure for Operation (delay value and strategy)

Related issue(s)

Resolves #1591

@github-actions

Copy link
Copy Markdown

👋 @SebastienDegodez

Welcome to the Microcks community! 💖

Thanks and congrats 🎉 for opening your first pull request here! Be sure to follow the pull request template or please update it accordingly.

Hope you have a great time there!

@SebastienDegodez
SebastienDegodez force-pushed the feature/1591-strategy-delay branch 3 times, most recently from 5098f0d to 6b8153c Compare September 12, 2025 18:13
@Apoorva64

Copy link
Copy Markdown
Contributor

Hello, I've read around the code, would it be possible to extract the delay handling to another class so that we can reuse it?

Futhermore I think it would be cool if we could configure the delay using openapi extensions https://microcks.io/documentation/references/artifacts/openapi-conventions/

@SebastienDegodez
SebastienDegodez force-pushed the feature/1591-strategy-delay branch from 6b8153c to d1e9127 Compare September 13, 2025 08:27
@SebastienDegodez

Copy link
Copy Markdown
Member Author

Hello, I've read around the code, would it be possible to extract the delay handling to another class so that we can reuse it?

Futhermore I think it would be cool if we could configure the delay using openapi extensions https://microcks.io/documentation/references/artifacts/openapi-conventions/

I think it's possible, yes :).
This PR is a draft, I haven't really developed in Java since 2008 (school), and aside from a small feature earlier this year.
I'm having some trouble running the tests locally 😅 (Maven and all... I'm not very familiar with it).

@SebastienDegodez
SebastienDegodez force-pushed the feature/1591-strategy-delay branch 3 times, most recently from 018b447 to b917a53 Compare September 14, 2025 15:40
@SebastienDegodez

SebastienDegodez commented Sep 14, 2025 •

Copy link
Copy Markdown
Member Author

For the next phase, I’m considering moving everything currently in util.delay (such as the Delay value object (actually rich business object), strategies, and factory) into the domain package. This would better reflect their role as core business objects rather than utilities.

However, I’m still hesitating about the mechanics with Jackson serialization/deserialization. I want to avoid any breaking changes, especially regarding how Operation is persisted and exposed in JSON. My goal is to keep the database and API structure flat (with defaultDelay and defaultDelayStrategy as separate fields).

I’ll need to carefully review the Jackson annotations and possibly add custom getters or setters to ensure backward compatibility for consumers and persistence.

Given my current level in Java, could you guide me @lbroudoux / @Apoorva64 ?

@SebastienDegodez SebastienDegodez changed the title Feature/1591 strategy delay feat: strategy delay #1591 Sep 14, 2025
@SebastienDegodez
SebastienDegodez force-pushed the feature/1591-strategy-delay branch from b917a53 to c440c0f Compare September 14, 2025 20:17

@lbroudoux lbroudoux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Made some comments along the way. It looks good but I would have called things differently. Please have a look ant let me know what you think.

@SebastienDegodez
SebastienDegodez marked this pull request as ready for review September 15, 2025 21:00
@SebastienDegodez

Copy link
Copy Markdown
Member Author

Made some comments along the way. It looks good but I would have called things differently. Please have a look ant let me know what you think.

Rename, constante, etc ... : Done.

Two subjects:

@lbroudoux

Copy link
Copy Markdown
Member

I think we're on track! What do you have in the mind regarding Preserved flat persistence structure for Operation (delay value and strategy) I'm not sure to understand...

@lbroudoux lbroudoux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I found a small glitch when you're extraction incoming request header for delay strategy. Please fix this one and we'll be good to go!

@SebastienDegodez

Copy link
Copy Markdown
Member Author

I found a small glitch when you're extraction incoming request header for delay strategy. Please fix this one and we'll be good to go!

During the refactoring, I accidentally introduced this issue that wasn’t caught by the initial test used to implement the delay. I’ve now added a much more precise test specifically targeting getDelay

@lbroudoux lbroudoux added this to the 1.13.0 milestone Sep 22, 2025

@lbroudoux lbroudoux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks al good to me! Thanks a lot @SebastienDegodez 🎉

@lbroudoux
lbroudoux changed the base branch from master to 1.13.x September 22, 2025 07:36
lbroudoux and others added 7 commits September 23, 2025 22:31
Expanding the wait before check a bit as we're low on resources and it takes tome

Signed-off-by: Laurent Broudoux <[email protected]>
…tern

- Introduced Delay value object encapsulating delay value and strategy
- Added DelayStrategy interface and implementations (Fixed, Random, RandomRanged)
- Implemented DelayStrategyFactory for controlled instantiation
- Refactored controllers and MetadataExtractor to use Delay VO
- Preserved flat persistence structure for Operation (delay value and strategy)

Signed-off-by: SebastienDegodez <[email protected]>
- Introduce DelayApplier and related classes for strategies
- Add shared constants: FIXED, RANDOM and RANDOM_RANGED_FORMAT / derived pattern.
- Rename Delay to DelaySpec

Signed-off-by: SebastienDegodez <[email protected]>
@SebastienDegodez
SebastienDegodez force-pushed the feature/1591-strategy-delay branch from 09b3d2b to fa59c4b Compare September 23, 2025 20:43
@lbroudoux
lbroudoux merged commit 11d5dff into microcks:1.13.x Sep 24, 2025
@github-actions

Copy link
Copy Markdown

🎉 @SebastienDegodez

You are now a Microcks community contributor! 💖

Thanks and congrats 🚀 on merging your first pull request! We are delighted and very proud of you! 👏

📢 If you're using Microcks in your organization, please add your company name to this list. 🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact.

If you need to know why and how to add yourself to the list, please read the blog post "Join the Microcks Adopters list and Empower the vibrant open source Community 🙌"

Kudos and please keep going, we need you 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make the "Default delay" variable dynamic for each endpoint

3 participants