Closed gedw99 closed 1 year ago
https://github.com/ergo-services/examples/blob/master/cloud/producer/go.mod Is correct ?
Yeah, this is correct, but it has an artifact :). The last line must be removed for sure (forgot to do that).
Is this because the type is on the consumers side and you want the producer to send the consumer well known types ?
producer imports consumer to be known of the consumer's message type. You definitely can move it out from the consumer package to somewhere else. But the main idea is to keep message types close to the owner (cmd/consumer
in this case). Anyway, it's just an example.
Also this begs the question , do producers and consumers know about each other at compile time ?
Ergo implements Erlang technologies, including EPMD. In Ergo this feature is embedded into the node, so you don't have to worry about that. It's like a local registrar of the running nodes keeping the node name and port number. Before making a TCP-connection, say to "abc@localhost", your node automatically resolves the port number requesting EMPD for the information where node "abc@localhsot" serves incoming connections.
Yeah, this is correct, but it has an artifact :). The last line must be removed for sure (forgot to do that).
cool. thanks for letting me know.
I am still new to this to even comment on how Types / protos work.
I am used to using NATS, which you probably know.
If there a concept of a Registry with Ergo ? SO that a producer can ask the registry for the type at runtime ?
I am used to using NATS, which you probably know.
Sure, I know it.
SO that a producer can ask the registry for the type at runtime ?
Golang is a strongly typed language. So you just can't do that. In order to marshal/unmarshal messages from/to the specific type golang's runtime should be known the type of sending/receiving messages on the compile time. That's the reason for the existing etf.RegisterType()
function.
right. i need to learn more about how this works. thanks for the explanation....
https://github.com/ergo-services/examples/blob/master/cloud/producer/go.mod Is correct ?
Is this because the type is on the consumers side and you want the producer to send the consumer well known types ?
Also this begs the question , do producers and consumers know about each other at compile time ?