Created
October 23, 2012 02:04
-
-
Save terrancesnyder/3936255 to your computer and use it in GitHub Desktop.
Interesting concept for self-assembling nodes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
infrastructure | |
.discover('solr') | |
.enter(function(instance) { // when a new instance has announced itself or come online again | |
// instance.port | |
// instance.core | |
// instance.ip | |
// instance.ttl | |
}) | |
.exit(function(instance) { // when an instance has left | |
// when an instance has left we can now unregister it | |
}); | |
// announce yourself to the infrastructure so | |
// that others can tie into you | |
infrastructure.announce('solr', { | |
port: 8080, // port we are running the service on | |
core: '0002-01', // unique core name | |
ip: '192.168.0.1', // the exposed address of the solr instance | |
ttl: 1000 // the time-to-live (after this we should check if we exist) | |
}); | |
// announce will continually announce at the TTL time, listen is responsible for detecting an outage | |
// and triggering the enter and exit functon | |
// announce we are leaving | |
infrastructure.leave('solr', { | |
port: 8080, // port we are running the service on | |
core: '0002-01', // unique core name | |
ip: '192.168.0.1', // the exposed address of the solr instance | |
ttl: 1000 // the time-to-live (after this we should check if we exist) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment