public abstract class ComponentVerticle
extends org.vertx.java.platform.Verticle
To create a Vertigo component simply extend this base class.
public class MyComponent extends ComponentVerticle {
public void start() {
output.port("out").send("Hello world!");
}
}
The component verticle works exactly the same way as all normal Vert.x
verticles. When the {@link ComponentVerticle#start()} method is called,
the the component and the network to which it belongs have been
completely started, so it's perfectly fine to begin sending messages.
The component also contains a reference to the cluster in which the
network is deployed. The cluster can be used to deploy
additional modules or verticles or access cluster-wide shared data.
For instance, if the network was deployed to a Xync cluster, the
cluster will be a {@link net.kuujo.vertigo.cluster.HazelcastCluster}
which can be used to access Hazelcast data structures.
The component also has a special logger which is a
{@link net.kuujo.vertigo.io.logging.logger.PortLogger} that is specific to
the component instance. The port logger will log any messages to
the underlying Vert.x {@link org.vertx.java.core.logging.Logger}
as well as the corresponding output port.
| Modifier and Type | Field and Description |
|---|---|
protected Cluster |
cluster |
protected InstanceContext |
context |
protected InputCollector |
input |
protected org.vertx.java.core.logging.Logger |
logger |
protected OutputCollector |
output |
protected Vertigo |
vertigo |
| Constructor and Description |
|---|
ComponentVerticle() |
protected Vertigo vertigo
protected InstanceContext context
protected Cluster cluster
protected org.vertx.java.core.logging.Logger logger
protected InputCollector input
protected OutputCollector output
public void start(org.vertx.java.core.Future<Void> startResult)
start in class org.vertx.java.platform.VerticleCopyright © 2013-2014. All Rights Reserved.