-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use VerticleBase in vertx-core examples
- Loading branch information
Showing
54 changed files
with
646 additions
and
550 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
9 changes: 6 additions & 3 deletions
9
core-examples/src/main/java/io/vertx/example/core/eventbus/pubsub/Sender.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
package io.vertx.example.core.eventbus.pubsub; | ||
|
||
import io.vertx.core.AbstractVerticle; | ||
import io.vertx.core.Future; | ||
import io.vertx.core.VerticleBase; | ||
import io.vertx.core.eventbus.EventBus; | ||
import io.vertx.launcher.application.VertxApplication; | ||
|
||
/* | ||
* @author <a href="http://tfox.org">Tim Fox</a> | ||
*/ | ||
public class Sender extends AbstractVerticle { | ||
public class Sender extends VerticleBase { | ||
|
||
public static void main(String[] args) { | ||
VertxApplication.main(new String[]{Sender.class.getName(), "-cluster"}); | ||
} | ||
|
||
@Override | ||
public void start() throws Exception { | ||
public Future<?> start() throws Exception { | ||
|
||
EventBus eb = vertx.eventBus(); | ||
|
||
// Send a message every second | ||
|
||
vertx.setPeriodic(1000, v -> eb.publish("news-feed", "Some news!")); | ||
|
||
return super.start(); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.