Producer and consumer unclear configuration

81 views
Skip to first unread message

Anderson Soares

unread,
Nov 1, 2021, 6:59:05 AM11/1/21
to Knative Users
Hi All,

I need a help with a quickly question.

I have the following scenario.

- Knative Serving  installed
- Knative Eventing installed
- Knative Eventing Kafka broker working.
My broker is connected with my Azure Event Hub, it's authenticated and working.

From here I would like to know what to do in order to make sure to produce messages from the producer(source) to my broker and consume these messages coming from the producer.
Do I need a trigger? What is the difference between trigger and subscriber? How do I consume and produce to the broker?
I read the documentation several times, but still unclear for me.

Thanks in advance,


pa...@triggermesh.com

unread,
Nov 1, 2021, 7:37:29 AM11/1/21
to Knative Users

Hi Anderson,

A broker

- is consumed by using triggers.
- consumers can filter by attribute.

Use them in scenarios where the events flowing are distinct in nature (multiple types, multiple attributes) and are akin to need filtering. An example would be an scenario where Github sources emit issue creation and updates information to a broker from multiple repos. If the issue comes from an internal repository it will be sent to Slack, if it is shared with a customer it will create an issue at Jira. All events flowing through the broker must be vaulted to Elasticsearch.

GH Source 1 -->
GH Source 2 -->
GH Source 3 -->
Other Sources -->
    Broker -->
        Trigger (type=gh issue, repository=private) --> Slack
        Trigger (type=gh issue, repository=shared) --> Sendgrid
        Trigger (no filter) --> Elasticsearch
        Trigger (type=others) --> DoWhatever

A channel

- is consumed using subscriptions.
- consumers get all data flowing through the channel.

Use them in scenarios where the messages flowing through the channel are exactly those expected by the consumers. An example would be a (or many) Github source emitting release creation messages to a channel, and a couple consumers that upon it will create a Slack message, and post a message to a mailing list through Sendgrid.

GH Source(s) -->
    Channel -->
        Subscription --> Slack
        Subscription --> Sendgrid


Producing to a broker or a channel is done by sending HTTP CloudEvents to their `status.address` URL.
You can curl manually a channel or a broker:

curl -v -X POST http://test-kn-channel.odacremolbap.svc.cluster.local  \
-H "content-type: application/json"  \
-H "ce-specversion: 1.0"  \
-H "ce-source: curl.client"  \
-H "ce-type: curl.sent.message"  \
-H "ce-id: 1234-abcd" \
-d '
{
      "name":"hellow",
      "description":"world",
      "number":42,
    }
'


PS. Can you point us to where the docs can be improved? Would a Broker vs Channel entry be clarifying?

Pablo Mercado

unread,
Nov 1, 2021, 11:02:55 AM11/1/21
to Knative Users
Bringing back the conversation here (we unpurposely DMd):

Hello Pablo,
It's clear, I've got my notes about what I'm thinking that is missing in the docs and I will share once I managed to accomplish my  goal, probably more I will have till there.
Regarding to produce to the broker via curl.
In this case I will have problems if I try directly, right?! because of .svc.cluster.local, I won't be able to resolve the host.
In this case how should we follow the approach? Making a port forward? 

I would use a curl pod maybe, 

 kubectl run curl-debug  -n your-ns --image=radial/busyboxplus:curl -i --tty --rm

I use curl, sockeye and cloudevents-player for debugging.
(recently a colleague demoed an open source debugger tool that  he is building that might be helpful, let me ping him to this thread).
 

--
You received this message because you are subscribed to the Google Groups "Knative Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to knative-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/knative-users/abca6587-7f95-4123-a3cb-06e916e0a9a0n%40googlegroups.com.

Jeff Neff

unread,
Nov 1, 2021, 11:07:34 AM11/1/21
to Knative Users
You can also try using this tool here -> https://github.com/JeffNeff/gtflp. It provides an easy way to send/monitor Cloudevents. Feel free to shoot me any questions you have on it! 
Reply all
Reply to author
Forward
0 new messages