SprnigCloud 由消息触发的输出
2023-12-13 11:49 更新
可以通过接收消息来触发输出消息,如以下示例所示:
Groovy DSL。
def dsl = Contract.make { description 'Some Description' label 'some_label' // input is a message input { // the message was received from this destination messageFrom('input') // has the following body messageBody([ bookName: 'foo' ]) // and the following headers messageHeaders { header('sample', 'header') } } outputMessage { sentTo('output') body([ bookName: 'foo' ]) headers { header('BOOK-NAME', 'foo') } } }
YAML。
# Human readable description description: Some description # Label by means of which the output message can be triggered label: some_label # input is a message input: messageFrom: input # has the following body messageBody: bookName: 'foo' # and the following headers messageHeaders: sample: 'header' # output message of the contract outputMessage: # destination to which the output message will be sent sentTo: output # the body of the output message body: bookName: foo # the headers of the output message headers: BOOK-NAME: foo
在前面的示例中,如果在input
目标上收到了适当的消息,则将输出消息发送到output
。在消息发布者侧,引擎生成一个测试,将该输入消息发送到定义的目的地。在
使用者方面,您可以将消息发送到输入目标,也可以使用标签(示例中为some_label
)来触发消息。
以上内容是否对您有帮助:
更多建议: