use of com.google.cloud.dialogflow.cx.v3beta1.Flow in project java-dialogflow-cx by googleapis.
the class CreateFlowIT method testCreateFlowGlobal.
@Test
public void testCreateFlowGlobal() throws Exception {
Flow result = CreateFlow.createFlow(DISPLAY_NAME, PROJECT_ID, LOCATION_GLOBAL, AGENT_ID_GLOBAL, EVENT_TO_FULFILLMENT_MESSAGES);
newFlowNameGlobal = result.getName();
assertEquals(result.getDisplayName(), DISPLAY_NAME);
// Number of added event handlers + 2 default event handlers.
assertEquals(result.getEventHandlersCount(), EVENT_TO_FULFILLMENT_MESSAGES.size() + 2);
}
use of com.google.cloud.dialogflow.cx.v3beta1.Flow in project cloudbreak by hortonworks.
the class StackTerminationFailureAction method createFlowContext.
@Override
protected StackFailureContext createFlowContext(String flowId, StateContext<StackTerminationState, StackTerminationEvent> stateContext, StackFailureEvent payload) {
Flow flow = getFlow(flowId);
StackView stackView = stackService.getByIdView(payload.getStackId());
MDCBuilder.buildMdcContext(stackView);
flow.setFlowFailed(payload.getException());
return new StackFailureContext(flowId, stackView);
}
use of com.google.cloud.dialogflow.cx.v3beta1.Flow in project cloudbreak by hortonworks.
the class StackCreationActions method stackCreationFailureAction.
@Bean(name = "STACK_CREATION_FAILED_STATE")
public Action<?, ?> stackCreationFailureAction() {
return new AbstractStackFailureAction<StackCreationState, StackCreationEvent>() {
@Override
protected StackFailureContext createFlowContext(String flowId, StateContext<StackCreationState, StackCreationEvent> stateContext, StackFailureEvent payload) {
Flow flow = getFlow(flowId);
StackView stackView = stackService.getByIdView(payload.getStackId());
MDCBuilder.buildMdcContext(stackView);
flow.setFlowFailed(payload.getException());
return new StackFailureContext(flowId, stackView);
}
@Override
protected void doExecute(StackFailureContext context, StackFailureEvent payload, Map<Object, Object> variables) {
stackCreationService.handleStackCreationFailure(context.getStackView(), payload.getException());
metricService.incrementMetricCounter(MetricType.STACK_CREATION_FAILED, context.getStackView());
sendEvent(context);
}
@Override
protected Selectable createRequest(StackFailureContext context) {
return new StackEvent(StackCreationEvent.STACKCREATION_FAILURE_HANDLED_EVENT.event(), context.getStackView().getId());
}
};
}
use of com.google.cloud.dialogflow.cx.v3beta1.Flow in project cloudbreak by hortonworks.
the class AbstractFlowConfiguration method createFlow.
@Override
public Flow createFlow(String flowId, Long stackId) {
StateMachine<S, E> sm = stateMachineFactory.getStateMachine();
FlowStructuredEventHandler<S, E> fl = applicationContext.getBean(FlowStructuredEventHandler.class, getEdgeConfig().initState, getEdgeConfig().finalState, getClass().getSimpleName(), flowId, stackId);
Flow flow = new FlowAdapter<>(flowId, sm, new MessageFactory<>(), new StateConverterAdapter<>(stateType), new EventConverterAdapter<>(eventType), (Class<? extends FlowConfiguration<E>>) getClass(), fl);
sm.addStateListener(fl);
return flow;
}
use of com.google.cloud.dialogflow.cx.v3beta1.Flow in project openflowplugin by opendaylight.
the class FlowMessageSerializer method writeInstructions.
/**
* Serialize OpenFlowPlugin instructions and set ip protocol of set-tp-src and set-tp-dst actions of need.
*
* @param message OpenFlow flow mod message
* @param outBuffer output buffer
*/
private void writeInstructions(final FlowMessage message, final ByteBuf outBuffer) {
final var instructions = message.getInstructions();
if (instructions == null) {
// Nothing to do
return;
}
// Extract all instructions ...
Stream<Instruction> flowInstructions = instructions.nonnullInstruction().values().stream().filter(Objects::nonNull).sorted(OrderComparator.build()).map(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Instruction::getInstruction).filter(Objects::nonNull);
// ... updated them if needed ...
final Uint8 protocol = extractProtocol(message);
if (protocol != null) {
flowInstructions = flowInstructions.map(insn -> updateInstruction(insn, protocol));
}
// ... and serialize them
flowInstructions.forEach(i -> InstructionUtil.writeInstruction(i, EncodeConstants.OF_VERSION_1_3, registry, outBuffer));
}
Aggregations