-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
517 additions
and
531 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- '6' | ||
- '8' | ||
install: | ||
- npm i npminstall && npminstall | ||
env: | ||
|
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,20 +1,23 @@ | ||
'use strict'; | ||
|
||
const co = require('co'); | ||
const logger = require('./logger'); | ||
const config = require('./config'); | ||
const httpclient = require('urllib'); | ||
const Producer = require('../').Producer; | ||
const Message = require('../').Message; | ||
|
||
const producer = new Producer(Object.assign({ httpclient, logger }, config)); | ||
co(function*() { | ||
yield producer.ready(); | ||
const msg = new Message(config.topic, // topic | ||
'TagA', // tag | ||
'Hello ONS !!! ' // body | ||
); | ||
(async () => { | ||
try { | ||
await producer.ready(); | ||
const msg = new Message(config.topic, // topic | ||
'TagA', // tag | ||
'Hello ONS !!! ' // body | ||
); | ||
|
||
const sendResult = yield producer.send(msg); | ||
console.log(sendResult); | ||
}).catch(err => console.error(err)); | ||
const sendResult = await producer.send(msg); | ||
console.log(sendResult); | ||
} catch (err) { | ||
console.error(err) | ||
} | ||
})(); |
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.