标签:
原始地址:
{
"conf": {
"topology.message.timeout.secs": 3,
// 各种的配置信息,可以按照上面的格式去写
},
"pidDir": "...",
"context": {
"task->component": {
"1": "example-spout",
"2": "__acker",
"3": "example-bolt1",
"4": "example-bolt2"
},
"taskid": 3,
// 下面的设置仅仅试用0.10.0之后的版本
"componentid": "example-bolt"
"stream->target->grouping": {
"default": {
"example-bolt2": {
"type": "SHUFFLE"}}},
"streams": ["default"],
"stream->outputfields": {"default": ["word"]},
"source->stream->grouping": {
"example-spout": {
"default": {
"type": "FIELDS",
"fields": ["word"]
}
}
}
"source->stream->fields": {
"example-spout": {
"default": ["word"]
}
}
}
}
脚本应当能创建出一个名字为PID的空文件,这个文件使得supervisor知道PID可以在随后关闭进程
自从0.10.0之后的版本的shell组件能配置的context被提高了,基本上包含了所有的方面的内容,可以被JVM使用。重要的特征是:stream->target->grouping和source->stream->grouping可以分别可以决定输入源和输出目标
{
"command": "emit",
// The id for the tuple. Leave this out for an unreliable emit. The id can
// be a string or a number.
"id": "1231231",
// The id of the stream this tuple was emitted to. Leave this empty to emit to default stream.
"stream": "1",
// If doing an emit direct, indicate the task to send the tuple to
"task": 9,
// All the values in this tuple
"tuple": ["field1", 2, 3]
}
{
"command": "log",
// the message to log
"msg": "hello world!"
}
{"command": "sync"}
直到发送另外的next或者ack或者fail指令的时候,ShellSpout才读取你的输出 和ISpout一样,如果没有流要发射的时候,应该在sync之前sleep一下,因为ShellSpout不会自动的sleep{
// The tuple‘s id - this is a string to support languages lacking 64-bit precision
"id": "-6955786537413359385",
// The id of the component that created this tuple
"comp": "1",
// The id of the stream this tuple was emitted to
"stream": "1",
// The id of the task that created this tuple
"task": 9,
// All the values in this tuple
"tuple": ["snow white and the seven dwarfs", "field2", 3]
}
{
"command": "emit",
// The ids of the tuples this output tuples should be anchored to
"anchors": ["1231231", "-234234234"],
// The id of the stream this tuple was emitted to. Leave this empty to emit to default stream.
"stream": "1",
// If doing an emit direct, indicate the task to send the tuple to
"task": 9,
// All the values in this tuple
"tuple": ["field1", 2, 3]
}
如果不立即发射的话,你将接收到,发射流的task id。因为异步的特性,在读之后发射的话,可能收不到task id,可能会读取到上一个发射的task id或者新的发射进程。但是不管怎样,你将会按照发射的顺序接收到task id。{
"command": "ack",
// the id of the tuple to ack
"id": "123123"
}
{
"command": "fail",
// the id of the tuple to fail
"id": "123123"
}
{
"command": "log",
// the message to log
"msg": "hello world!"
}
{
"id": "-6955786537413359385",
"comp": "1",
"stream": "__heartbeat",
// this shell bolt‘s system task id
"task": -1,
"tuple": []
}
当子进程接收到心跳tuple的时候,会发送sync给ShellBoltMulti-Lang protocol of Storm/多语言协议的翻译
标签:
原文地址:http://www.cnblogs.com/kongchung/p/5552091.html