Permalink
Browse files

VCAP::Component.register returns its configuration

A component that registers itself does not know
its own port number nor credentials, if not provided.

The .register method now returns the component's
configuration data which contains this information.

Change-Id: I1db688ded6ec2565cc419d95d80345bdf78d40ef
  • Loading branch information...
1 parent b9024a5 commit 45cd194dce44d590512d50d344f66cbe84b46732 @drnic drnic committed Nov 11, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/vcap/component.rb
@@ -144,6 +144,9 @@ def uuid
@discover[:uuid]
end
+ # Announces the availability of this component to NATS.
+ # Returns the published configuration of the component,
+ # including the ephemeral port and credentials.
def register(opts)
uuid = VCAP.secure_uuid
type = opts[:type]
@@ -188,6 +191,8 @@ def register(opts)
# Also announce ourselves on startup..
nats.publish('vcap.component.announce', @discover.to_json)
+
+ @discover
end
def update_discover_uptime

0 comments on commit 45cd194

Please sign in to comment.