W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
可以通過(guò)調(diào)用方法(例如啟動(dòng)a并發(fā)送消息時(shí)調(diào)用Scheduler
)來(lái)觸發(fā)輸出消息,如以下示例所示:
Groovy DSL。
def dsl = Contract.make { // Human readable description description 'Some description' // Label by means of which the output message can be triggered label 'some_label' // input to the contract input { // the contract will be triggered by a method triggeredBy('bookReturnedTriggered()') } // 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 { 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: # the contract will be triggered by a method triggeredBy: bookReturnedTriggered() # 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
在前面的示例情況下,如果執(zhí)行了稱為bookReturnedTriggered
的方法,則輸出消息將發(fā)送到output
。在消息發(fā)布者方面,我們生成了一個(gè)測(cè)試,該測(cè)試調(diào)用該方法來(lái)觸發(fā)消息。在使用者方面,您可以使用some_label
來(lái)觸發(fā)消息。
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: