Tabnine Logo
CoreEvent.getContext
Code IndexAdd Tabnine to your IDE (free)

How to use
getContext
method
in
org.mule.runtime.core.api.event.CoreEvent

Best Java code snippets using org.mule.runtime.core.api.event.CoreEvent.getContext (Showing top 20 results out of 315)

origin: mulesoft/mule

/**
 * Events have a list of message processor paths it went trough so that the execution path of an event can be reconstructed
 * after it has executed.
 *
 * @return the message processors trace associated to the given event.
 */
public static ProcessorsTrace getProcessorsTrace(CoreEvent event) {
 return ((BaseEventContext) event.getContext()).getProcessorsTrace();
}
origin: mulesoft/mule

private void completeEventContext() {
 if (requestEvent != null) {
  ((BaseEventContext) requestEvent.getContext()).success();
 }
}
origin: mulesoft/mule

private CoreEvent handleError(Throwable error, CoreEvent childEvent) {
 try {
  errorHandler.accept(error, EventedResult.from(childEvent));
 } catch (Throwable e) {
  ((BaseEventContext) originalEvent.getContext()).error(e);
 }
 return null;
}
origin: mulesoft/mule

@Override
public CoreEvent process(CoreEvent event) throws MuleException {
 eventContextService.getCurrentlyActiveFlowStacks().stream()
   .filter(fsde -> fsde.getEventId().equals(event.getContext().getId())).findAny()
   .ifPresent(dumpEntry -> stackToAssert = dumpEntry.getFlowCallStack());
 return event;
}
origin: mulesoft/mule

protected CoreEvent buildEvent(String eventId, FlowCallStack flowStack) {
 CoreEvent event = mock(CoreEvent.class);
 when(event.getContext()).thenReturn(messageContext);
 when(event.getContext()).thenReturn(messageContext);
 when(event.getFlowCallStack()).thenReturn(flowStack);
 return event;
}
origin: mulesoft/mule

 @Override
 public Supplier<CorrelationInfo> resolve(ExecutionContext executionContext) {
  return () -> {
   CoreEvent event = ((ExecutionContextAdapter) executionContext).getEvent();
   return new ImmutableCorrelationInfo(event.getContext().getId(), true, event.getCorrelationId(),
                     event.getItemSequenceInfo().orElse(null));
  };
 }
}
origin: mulesoft/mule

/**
 * Creates a new instance
 *
 * @param event the event on which the operation is being executed.
 */
public DefaultFlowListener(ExtensionModel extensionModel, OperationModel operationModel, CoreEvent event) {
 this.extensionModel = extensionModel;
 this.operationModel = operationModel;
 BaseEventContext context = (BaseEventContext) event.getContext();
 context.onResponse(this::onResponse);
 context.getRootContext().onTerminated((e, t) -> onTerminated());
}
origin: mulesoft/mule

 private CoreEvent runFlow(Flow flow, CoreEvent event, OAuthConfig config, String callbackType) {
  final Publisher<CoreEvent> childPublisher =
    processWithChildContext(event, flow, child((BaseEventContext) event.getContext(), of(flow.getLocation())));
  return from(childPublisher)
    .onErrorMap(MuleException.class,
          e -> new MuleRuntimeException(createStaticMessage(format("Error found while execution flow '%s' which is configured in the '%s' parameter "
            + "of the '%s' config", flow.getName(), callbackType, config.getOwnerConfigName()), e)))
    .block();
 }
}
origin: mulesoft/mule

@Before
public void setup() {
 logger = new ThreadNotificationLogger(service, true);
 when(event.getContext()).thenReturn(context);
 when(context.getId()).thenReturn("id");
}
origin: mulesoft/mule

private Object resolveCursorStreamProvider(InputStream value) {
 CursorProviderFactory factory = cursorProviderFactory.accepts(value)
   ? cursorProviderFactory
   : streamingManager.forBytes().getDefaultCursorProviderFactory();
 return factory.of(((BaseEventContext) event.getContext()).getRootContext(), value);
}
origin: mulesoft/mule

private Object resolveCursorIteratorProvider(Iterator value) {
 CursorProviderFactory factory = cursorProviderFactory.accepts(value)
   ? cursorProviderFactory
   : streamingManager.forObjects().getDefaultCursorProviderFactory();
 return factory.of(((BaseEventContext) event.getContext()).getRootContext(), value);
}
origin: mulesoft/mule

@Test
public void cursorStreamProvidersAreManaged() throws Exception {
 CursorStreamProvider provider = mock(CursorStreamProvider.class);
 final InputStream inputStream = mock(InputStream.class);
 doReturn(provider).when(cursorStreamProviderFactory).of(((BaseEventContext) event.getContext()).getRootContext(),
                             inputStream);
 when(operationExecutor.execute(any())).thenReturn(just(inputStream));
 messageProcessor.process(event);
 verify(streamingManager).manage(same(provider), any(EventContext.class));
}
origin: mulesoft/mule

@Before
public void setup() {
 EventContext ctx = mock(EventContext.class);
 when(event.getContext()).thenReturn(ctx);
 when(mockExpressionManager.openSession(any(), any(), any())).thenReturn(session);
 when(session.evaluate(anyObject())).thenReturn(new TypedValue("something", DataType.STRING));
 when(session.evaluate(anyObject(), anyObject())).thenReturn(new TypedValue("something", DataType.STRING));
}
origin: mulesoft/mule

protected HeisenbergExtension lookupHeisenberg(String key) throws Exception {
 CoreEvent heisenbergEvent = null;
 try {
  heisenbergEvent = getHeisenbergEvent();
  return lookupHeisenberg(key, heisenbergEvent);
 } finally {
  if (heisenbergEvent != null) {
   ((BaseEventContext) heisenbergEvent.getContext()).success();
  }
 }
}
origin: mulesoft/mule

@Test
public void testExecuteWithInputEvent() throws Exception {
 ExecutionResult executionResult = executableComponent.execute(InputEvent.create().message(requestMessage)).get();
 Event response = executionResult.getEvent();
 assertThat(componentInEvent.get().getMessage(), equalTo(requestMessage));
 assertThat(response.getMessage(), equalTo(responseMessage));
 assertThat(componentInEvent.get().getContext(), equalTo(response.getContext()));
 BaseEventContext eventContext = (BaseEventContext) componentInEvent.get().getContext();
 assertThat(eventContext.isTerminated(), is(false));
 executionResult.complete();
 assertThat(eventContext.isTerminated(), is(true));
}
origin: mulesoft/mule

private void assertPreNotification(CoreEvent inEvent, MessageProcessorNotification preNotification) {
 assertThat(preNotification.getAction().getActionId(), equalTo(MESSAGE_PROCESSOR_PRE_INVOKE));
 assertThat(preNotification.getEventContext(), equalTo(inEvent.getContext()));
 assertThat(preNotification.getEvent(), equalTo(inEvent));
 assertThat(preNotification.getException(), is(nullValue()));
}
origin: mulesoft/mule

private IronMan getIronMan(String name) throws Exception {
 CoreEvent initialiserEvent = null;
 try {
  initialiserEvent = getInitialiserEvent(muleContext);
  return (IronMan) getConfigurationInstanceFromRegistry(name, initialiserEvent, muleContext).getValue();
 } finally {
  if (initialiserEvent != null) {
   ((BaseEventContext) initialiserEvent.getContext()).success();
  }
 }
}
origin: mulesoft/mule

@Test
public void customCorrelationId() throws Exception {
 final String correlationId = "correlateThis";
 final CoreEvent event =
   flowRunner("correlate").withSourceCorrelationId(correlationId).withItemSequenceInfo(of(43, 100)).run();
 CorrelationInfo correlationInfo = (CorrelationInfo) event.getMessage().getPayload().getValue();
 assertThat(correlationInfo.getEventId(), is(event.getContext().getId()));
 assertThat(correlationInfo.isOutboundCorrelationEnabled(), is(true));
 assertThat(correlationInfo.getCorrelationId(), is(correlationId));
 assertThat(correlationInfo.getItemSequenceInfo().get().getPosition(), is(43));
 assertThat(correlationInfo.getItemSequenceInfo().get().getSequenceSize().getAsInt(), is(100));
}
origin: mulesoft/mule

protected ReactiveProcessor processor() {
 return eventPub -> {
  Flux<CoreEvent> baseFlux = Flux.from(eventPub);
  if (processChangeThread) {
   baseFlux = baseFlux.publishOn(Schedulers.single());
  }
  return baseFlux
    .doOnNext(ev -> flowActualResultEvent = ev)
    .doOnNext(event -> ((BaseEventContext) event.getContext()).success(event));
 };
}
origin: mulesoft/mule

@Test
public void defaultCorrelationInfo() throws Exception {
 final CoreEvent event = flowRunner("correlate").run();
 CorrelationInfo correlationInfo = (CorrelationInfo) event.getMessage().getPayload().getValue();
 assertThat(correlationInfo.getEventId(), is(event.getContext().getId()));
 assertThat(correlationInfo.isOutboundCorrelationEnabled(), is(true));
 assertThat(correlationInfo.getCorrelationId(), is(correlationInfo.getCorrelationId()));
 assertThat(correlationInfo.getItemSequenceInfo(), is(empty()));
}
org.mule.runtime.core.api.eventCoreEventgetContext

Popular methods of CoreEvent

  • getMessage
  • builder
    Create new Builder based on an existing CoreEvent instance. The existing EventContext is conserved.
  • getError
  • getVariables
  • getSecurityContext
    The security context for this session. If not null outbound, inbound and/or method invocations will
  • asBindingContext
  • getCorrelationId
  • getFlowCallStack
    Events have a stack of executed flows (same as a call stack), so that at any given instant an applic
  • getItemSequenceInfo
  • getAuthentication
  • getGroupCorrelation
    Returns the correlation metadata of this message. See GroupCorrelation.
  • getVariableValueOrNull
    Helper method to get the value of a given variable in a null-safe manner such that null is returned
  • getGroupCorrelation,
  • getVariableValueOrNull

Popular in Java

  • Creating JSON documents from java classes using gson
  • getExternalFilesDir (Context)
  • getSharedPreferences (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • JList (javax.swing)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now