Skip to content

fix: Enable support for specifying a PubSub emulator host - #1851

Merged
lbroudoux merged 3 commits into
1.13.xfrom
unknown repository
Dec 5, 2025
Merged

lbroudoux merged 3 commits into
1.13.xfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Dec 4, 2025

Copy link
Copy Markdown

Description

  • Use PUBSUB_EMULATOR_HOST on the PubSub producer to configure for an emulator
  • Use a host name in the endpointUrl spec for the PubSub consumer to consume from an emulator

Related issue(s)

Fixes #1846

@ghost
ghost requested review from lbroudoux and yada as code owners December 4, 2025 14:19
@github-actions

github-actions Bot commented Dec 4, 2025

Copy link
Copy Markdown

👋 @adamhicks-dojo

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!

🌟 ~~~~~~~~~ 🌟

📢 If you like Microcks, please ⭐ star ⭐ our repo to support it!

🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact.

@ghost
ghost changed the base branch from master to 1.13.x December 4, 2025 14:34
@ghost ghost changed the title fix: Use PubSub emulator if PUBSUB_EMULATOR_HOST is defined fix: Enable support for specifying a PubSub emulator host Dec 4, 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.

This looks great. I just requested a small change on how the emulatorHost is provided during a test.


/** The string for Regular Expression that helps validating acceptable endpoints. */
public static final String ENDPOINT_PATTERN_STRING = "googlepubsub://(?<projectId>[a-zA-Z0-9-_]+)/(?<topic>[a-zA-Z0-9-_\\.]+)(\\?(?<options>.+))?";
public static final String ENDPOINT_PATTERN_STRING = "googlepubsub://((?<emulator>[^:]+(:\\d+)?)/)?(?<projectId>[a-zA-Z0-9-_]+)/(?<topic>[a-zA-Z0-9-_\\.]+)(\\?(?<options>.+))?";

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 would prefer managing the emulator stuff with an addition option like we did for LocalStack on AWS.

If you look here, you'll see that we have defined an overrideUrl option. Here in the case of PubSub, it could be emulatorHost.

This allows to keep consistent URIs:

  • googlepubsub://my-project-test/my-topic
  • googlepubsub://my-project-test/my-topic?emulatorHost=emulator:8585

When initializing connection and channels, you can then use the hasOption(EMULATOR_HOST_OPTION) like we did here to create the additional channel provider.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ok, i don't have time today, but i'll get these changes done tomorrow 👍

@ghost ghost Dec 5, 2025 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done (i think)

@ghost
ghost requested a review from lbroudoux December 5, 2025 12:01

@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 all good to me. Thanks for contributing this!

@github-actions

github-actions Bot commented Dec 5, 2025

Copy link
Copy Markdown

🎉 @adamhicks-dojo

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 🙌

🌟 ~~~~~~~~~ 🌟

📢 If you like Microcks, please ⭐ star ⭐ our repo to support it!

🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact.

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.

Enable Google PubSub Emulator

2 participants