248.4.2. 停止应用程序

// stopping the foobar application
from("direct:control")
    .to("openshift:myClient?username=foo&password=secret&operation=stop&application=foobar");
 

在上面的示例中,我们停止名为 foobar 的应用程序。

 

轮询 gear 状态更改

使用者用于 Gears 中的轮询状态变化。例如,当添加新设备/删除/或其生命周期被改变、eg started 或 stopped 等时。

// trigger when state changes on our gears
from("openshift:myClient?username=foo&password=secret&delay=30s")
    .log("Event ${header.CamelOpenShiftEventType} on application ${body.name} changed state to ${header.CamelOpenShiftEventNewState}");

 

当消费者发出 Exchange 时,正文包含 com.openshift.client.IApplication 作为消息正文。包括以下标头。

标头可以是 null描述

CamelOpenShiftEventType

事件类型,可以是:添加、删除或更改的。

CamelOpenShiftEventOldState

事件类型更改时,旧状态。

CamelOpenShiftEventNewState

任何事件类型的新状态