nytlabs / colony Goto Github PK
View Code? Open in Web Editor NEWa lightweight microservice framework for NSQ
License: Apache License 2.0
a lightweight microservice framework for NSQ
License: Apache License 2.0
I wonder if it is a good idea to implement a method that would afford the ability for a Colony service to clean up after itself. Something like Stop()
would remove the channels created in NSQ.
This would be especially helpful in the creation of things that are single-use services. For instance, if I am testing and I want to submit a single query and examine the response, I'd like this testing utility to remove channels/topics on exit.
There are several fields in the Message
type that are used by Colony internals, that if modified by a user, could create mayhem.
For instance, if a service could receive messages and change MessageID
, Time
, ContentType
, Topic
, etc, and "respond" and who knows where the message would go or what it would do. IMO, any field expressing state within Colony should be hidden or have some kind of getter.
When you Produce
a message, you need to specify nil or some kind of function to handle the response.
However the Consumer
returns a chan for messages to be consumed.
Could parity could be created by doing away with handlers entirely, and having colony.Message
have a .C
as well?
so:
m := s.NewMessage("bees",[]byte("bzzz"));
s.Produce(m, handler)
becomes
m := s.NewMessage("bees",[]byte("bzzz"));
s.Produce(m)
response := <-m.C
(would also be nice if Produce
was renamed to Emit
maybe?)
Produce
currently accepts a message and a handler, but not all messages need handlers.
What abut
Emit(colony.Message)
and Request(colony.Message, colony.HandlerFunc)
I may not fully understand the use case, but if a Colony service announces a type it is producing, shouldn't Emit()
always produce messages given by function Announce()
? For example, if I declare my service is sending bees
should I have to specify that each message of type bees
The exception here is if a service wants to produce different kinds of messages than what it emits, but I would say that affordance could be confusing.
I just used Emit() to send a message type different than what I announced and I am not sure that is desirable behavior.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.