-
Notifications
You must be signed in to change notification settings - Fork 5
MetaData in client #6
Description
It seems that as of now, the client takes the specific IP address of one single Liftbridge node.
Imagine we have a cluster of Liftbridge nodes, naming alpha, beta and theta respectively.
You create a stream using
client.create_stream(Stream(subject, name))By default, this stream has 1 partition, and replicated on one node, for the sake of argument, let's assume that it is replicated on alpha.
Then the client, let say, subscribe to beta, effectively, it does not see any incoming message.
I guess the only solution is instead of subscribing to the node's address, the client should fetch the MetaData, and parse it correctly to find the correct node to subscribe to.
I am thinking how to implement this. One solution would be, instead of using inheritance as of now
class Lift(BaseClient):we could change and use composition:
class Lift(object):
def __init__(self, ip_address, **kargs):
self.conn = BaseClient(ip_address, **kargs)
self.meta_cache = NoneAnd thus, whenever needed, we can refresh the MetaData stored as meta_cache, and recreate the self.conn object in order to bind to the correct node for subscription.
Would be glad to discuss and share what you think.