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

[BUG] Glee subscribes to topics using channel names instead of "channel.address" (v3) #732

Closed
2 tasks done
ivangsa opened this issue Mar 5, 2024 · 8 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@ivangsa
Copy link

ivangsa commented Mar 5, 2024

Describe the bug.

Glee subscribes to topics using channel names instead of "channel.address" (v3)

https://github.com/asyncapi/glee/blob/master/src/adapters/kafka/index.ts#L66

This may be related to #673

Expected behavior

It should subscribe to channel.address

Also, is very frequent in organizations not to have a dedicated Broker for each environment, and that the channel address depends on the environment.

Maybe this should be configurable somehow..

Screenshots

This function returns channel names, not channel address.

    const subscribedChannels = this.getSubscribedChannels()
    await consumer.subscribe({
      topics: subscribedChannels,
      fromBeginning: true,
    })

How to Reproduce

  1. I first did this
  2. I then did this
  3. And so on . . .

🥦 Browser

None

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

No, someone else can work on it

@ivangsa ivangsa added the bug Something isn't working label Mar 5, 2024
@KhudaDad414
Copy link
Member

Also, is very frequent in organizations not to have a dedicated Broker for each environment, and that the channel address depends on the environment.

Hey @ivangsa, can you explain this a little more? 🙏

@ivangsa
Copy link
Author

ivangsa commented Mar 5, 2024

In the last two organizations I worked there is one Kafka Broker for PRO and another shared one for Staging, Integration and Dev

so topics in the shared broker can not use just the same topic name as in PRO, because there would be more than one, so we use a naming convention:

given an asyncapi.yml like:

channels:
  CustomerEventsChannel:
    address: "customer.events"

Topics would follow a naming convention similar to this one:

  • PRO: customer.events
  • PRE: customer.events.pre
  • DEV: customer.events.dev

Hope this clarifies the point.

@fmvilas
Copy link
Member

fmvilas commented Mar 6, 2024

Topics would follow a naming convention similar to this one:

PRO: customer.events
PRE: customer.events.pre
DEV: customer.events.dev

I think you should be able to solve that if your channel address becomes something like customer.events.{environment}. However, this would match customer.events.pre and customer.events.dev but not customer.events. My recommendation is that we don't do any hack on Glee to add stuff to the addresses but instead rely on the AsyncAPI file definitions. If these addresses exist, they should be reflected in the AsyncAPI document and their channels associated with specific servers (like dev or pre).

@ivangsa
Copy link
Author

ivangsa commented Mar 6, 2024

ok, thanks @fmvilas

if I understood, the {environment} value can be defined for glee using environment variables, like:

GLEE_SERVER_VARIABLES=pre:environment:.pre

(this would set environment=.pre for the pre server, mind the dot in .pre)

I hope this empty value GLEE_SERVER_VARIABLES=pro:environment: would work also for pro

This would definitely solve that part.

@eelcofolkertsma
Copy link

Can we have both honored?

Many organizations differentiate between production, and various integration environments (yes!)
Be spec driven: async api spec should support environment differentiation either at server-level or at addressing-level

How about channel address=customer.events{environment} and environment=.pre|.sta|. Empty for environment than is production

@eelcofolkertsma
Copy link

I am not an experienced developer, but if you feel this is an easy bug I am happy to dive into the mud. Please advise

@eelcofolkertsma
Copy link

Same issue is reported as #721

@KhudaDad414
Copy link
Member

closing since it's a duplicate of #721

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants