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
| module.exports = (user) => { | |
| // Send a welcome email or whatever. | |
| } |
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
| const myEmitter = require('./my_emitter'); | |
| const sendEmailOnRegistration = require('./send_email_on_registration'); | |
| const someOtherListener = require('./some_other_listener'); | |
| myEmitter.on('user-registered', sendEmailOnRegistration); | |
| myEmitter.on('user-registered', someOtherListener); |
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
| const myEmitter = require('./my_emitter'); | |
| myEmitter.on('user-registered', (user) => { | |
| // Send an email or whatever. | |
| }); |
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
| const myEmitter = require('./my_emitter'); | |
| // Perform the registration steps | |
| // Pass the new user object as the message passed through by this event. | |
| myEmitter.emit('user-registered', user); |
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
| const EventEmitter = require('events'); | |
| const myEmitter = new EventEmitter(); | |
| module.exports = myEmitter; |
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
| public static void main(String[] args) throws Exception | |
| { | |
| TopologyBuilder builder = new TopologyBuilder(); | |
| builder.setSpout("word", new TestWordSpout(), 10); | |
| builder.setBolt("exclaim1", new ExclamationBolt(), 3).shuffleGrouping("word"); | |
| builder.setBolt("exclaim2", new ExclamationBolt(), 2).shuffleGrouping("exclaim1"); |
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
| # Telling the Supervisor where the Zookeeper is. | |
| storm.zookeeper.servers: | |
| - "zookeeper" | |
| # The worker nodes need to know which machine(s) are the candidate of master | |
| # in order to download the topology jars. | |
| nimbus.seeds : ["storm-nimbus"] | |
| # For each Supervisor, we configure how many workers run on that machine. | |
| # Each worker uses a single port for receiving messages, and this setting |
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
| # The Nimbus needs to know where the Zookeeper is. This specifies the list of the | |
| # hosts in the Zookeeper cluster. We're using just one node, of course. | |
| # 'zookeeper' is the Docker Compose network reference. | |
| storm.zookeeper.servers: | |
| - "zookeeper" |
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
| version: '3.2' | |
| services: | |
| zookeeper: | |
| build: ./zookeeper | |
| # Keep it running. | |
| tty: true | |
| storm-nimbus: | |
| build: ./storm-nimbus |
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
| package packagename | |
| // … | |
| public class OurSimpleTopology { | |
| public static void main(String[] args) throws Exception | |
| { | |
| // Create the topology | |
| TopologyBuilder builder = new TopologyBuilder(); |