congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
CoreEvent.getCorrelationId
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: mulesoft/mule

 @Override
 public CoreEvent process(CoreEvent event) throws MuleException {
  correlationId = event.getCorrelationId();
  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

private void assertLogicallyEqualEvents(final CoreEvent testEvent, CoreEvent eventReceived) throws MuleException {
 // events have been rewritten so are different but the correlation ID has been carried around
 assertEquals(testEvent.getCorrelationId(), eventReceived.getCorrelationId());
 // and their payload
 assertEquals(testEvent.getMessage(), eventReceived.getMessage());
}
origin: mulesoft/mule

@Test
public void initAfterDeserializationAfterProcess() throws Exception {
 when(mockEventCorrelatorCallback.shouldAggregateEvents(mockEventGroup)).thenReturn(false);
 when(mockMuleEvent.getCorrelationId()).thenReturn(TEST_GROUP_ID);
 EventCorrelator eventCorrelator = createEventCorrelator();
 eventCorrelator.process(mockMuleEvent);
 verify(mockEventGroup, times(1)).initAfterDeserialisation(mockMuleContext);
}
origin: mulesoft/mule

@Test
public void testEventGroupFreedInRoutingException() throws Exception {
 CoreEvent event = mock(CoreEvent.class);
 when(event.getCorrelationId()).thenReturn(GROUP_NAME);
 try {
  eventCorrelator.process(event);
  fail("Routing Exception must be catched.");
 } catch (RoutingException e) {
  assertTrue("Event Group wasn't saved", eventGroupWasSaved);
  assertThat(countOfEventGroups, is(0));
 }
}
origin: mulesoft/mule

@Test
public void correlationId() throws Exception {
 when(event.getCorrelationId()).thenReturn("3");
 assertEquals("3", evaluate("message.correlationId", event));
 assertFinalProperty("message.correlationId=2", event);
}
origin: mulesoft/mule

private void assertTargetEvent(CoreEvent request) {
 // Assert that event is processed in async thread
 assertNotNull(target.sensedEvent);
 assertThat(request, not(sameInstance(target.sensedEvent)));
 assertThat(request.getCorrelationId(), equalTo(target.sensedEvent.getCorrelationId()));
 assertThat(request.getMessage(), sameInstance(target.sensedEvent.getMessage()));
 assertThat(target.thread, not(sameInstance(currentThread())));
}
origin: mulesoft/mule

@Test
public void overrideCorrelationIdInContext() {
 final Message message = of(TEST_PAYLOAD);
 final CoreEvent event = InternalEvent.builder(executionContextWithCorrelation).message(message)
   .groupCorrelation(empty()).build();
 assertThat(event.getCorrelationId(), is(CUSTOM_CORRELATION_ID));
}
origin: mulesoft/mule

@Test
public void noCorrelationIdInContext() {
 final Message message = of(TEST_PAYLOAD);
 final CoreEvent event = InternalEvent.builder(executionContext).message(message).build();
 assertThat(event.getCorrelationId(), is(GENERATED_CORRELATION_ID));
}
origin: mulesoft/mule

@Test
public void correlationIdInContext() {
 final Message message = of(TEST_PAYLOAD);
 final CoreEvent event = InternalEvent.builder(executionContextWithCorrelation).message(message).build();
 assertThat(event.getCorrelationId(), is(CUSTOM_CORRELATION_ID));
}
origin: mulesoft/mule

@Test
public void testHandleExceptionWithMessageProcessorsChangingEvent() throws Exception {
 CoreEvent lastEventCreated = InternalEvent.builder(context).message(of("")).build();
 onErrorContinueHandler
   .setMessageProcessors(asList(createChagingEventMessageProcessor(InternalEvent.builder(context).message(of(""))
     .build()),
                  createChagingEventMessageProcessor(lastEventCreated)));
 onErrorContinueHandler.setAnnotations(getAppleFlowComponentLocationAnnotations());
 initialiseIfNeeded(onErrorContinueHandler, muleContext);
 when(mockException.handled()).thenReturn(true);
 when(mockException.getDetailedMessage()).thenReturn(DEFAULT_LOG_MESSAGE);
 when(mockException.getEvent()).thenReturn(muleEvent);
 CoreEvent exceptionHandlingResult = onErrorContinueHandler.handleException(mockException, muleEvent);
 verify(mockException).setHandled(true);
 assertThat(exceptionHandlingResult.getCorrelationId(), is(lastEventCreated.getCorrelationId()));
}
origin: mulesoft/mule

@Test
public void overrideCorrelationIdInContextSequence() {
 final Message message = of(TEST_PAYLOAD);
 final CoreEvent event =
   InternalEvent.builder(executionContextWithCorrelation).message(message).correlationId(CUSTOM_CORRELATION_ID)
     .groupCorrelation(Optional.of(GroupCorrelation.of(6))).build();
 assertThat(event.getCorrelationId(), is(CUSTOM_CORRELATION_ID));
}
origin: mulesoft/mule

@Test
public void eventGroupConversionToString() throws Exception {
 EventGroup eg = new EventGroup(UUID.getUUID(), muleContext);
 eg.initEventsStore(objectStore);
 String es = eg.toString();
 assertTrue(es.endsWith("events=0}"));
 CoreEvent firstEvent = eventBuilder(muleContext).message(Message.of("foo")).build();
 String firstId = firstEvent.getCorrelationId();
 eg.addEvent(firstEvent);
 es = eg.toString();
 assertTrue(es.contains("events=1"));
 assertTrue(es.endsWith("[" + firstId + "]}"));
 CoreEvent secondEvent = eventBuilder(muleContext)
   .message(Message.of("foo2"))
   .build();
 String secondId = secondEvent.getCorrelationId();
 eg.addEvent(secondEvent);
 es = eg.toString();
 assertTrue(es.contains("events=2"));
 assertTrue(es.contains(firstId));
 assertTrue(es.contains(secondId));
}
origin: mulesoft/mule

@Test
public void operationFiresNotificationsWithCustomData() throws Exception {
 Latch latch = new Latch();
 setUpListener(notification -> checkIfDone(latch, 2), false);
 String correlationId = flowRunner("operationNotification").run().getCorrelationId();
 assertThat("Expected notifications not received.", latch.await(6000, MILLISECONDS), is(true));
 MultiMap<String, ExtensionNotification> notifications = listener.getNotifications();
 Set<String> keys = notifications.keySet();
 assertThat(keys, hasItem(KNOCKING_DOOR));
 assertThat(keys, hasItem(KNOCKED_DOOR));
 ExtensionNotification knockingDoor = notifications.get(KNOCKING_DOOR);
 assertThat(knockingDoor, is(notNullValue()));
 assertThat(knockingDoor.getAction().getNamespace(), is(HEISENBERG));
 assertThat(knockingDoor.getData().getValue(), instanceOf(SimpleKnockeableDoor.class));
 assertThat(((SimpleKnockeableDoor) knockingDoor.getData().getValue()).getSimpleName(),
       is("Top Level Skyler @ 308 Negra Arroyo Lane"));
 assertThat(knockingDoor.getEvent().getCorrelationId(), is(correlationId));
 ExtensionNotification knockedDoor = notifications.get(KNOCKED_DOOR);
 assertThat(knockedDoor, is(notNullValue()));
 assertThat(knockedDoor.getAction().getNamespace(), is(HEISENBERG));
 assertThat(knockedDoor.getData().getValue(), instanceOf(SimpleKnockeableDoor.class));
 assertThat(((SimpleKnockeableDoor) knockedDoor.getData().getValue()).getSimpleName(),
       is("Top Level Skyler @ 308 Negra Arroyo Lane"));
 assertThat(knockedDoor.getEvent().getCorrelationId(), is(correlationId));
}
origin: mulesoft/mule

assertThat(result.getCorrelationId(), equalTo(event1.getCorrelationId()));
origin: org.mule.runtime/mule-module-extensions-spring-support

 @Override
 public CoreEvent process(CoreEvent event) throws MuleException {
  correlationId = event.getCorrelationId();
  return event;
 }
}
origin: org.mule.runtime/mule-module-extensions-support

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

@Test
public void overrideCorrelationIdInContext() {
 final Message message = of(TEST_PAYLOAD);
 final CoreEvent event = InternalEvent.builder(executionContextWithCorrelation).message(message)
   .groupCorrelation(empty()).build();
 assertThat(event.getCorrelationId(), is(CUSTOM_CORRELATION_ID));
}
origin: org.mule.runtime/mule-core-tests

@Test
public void correlationIdInContext() {
 final Message message = of(TEST_PAYLOAD);
 final CoreEvent event = InternalEvent.builder(executionContextWithCorrelation).message(message).build();
 assertThat(event.getCorrelationId(), is(CUSTOM_CORRELATION_ID));
}
origin: org.mule.runtime/mule-core-tests

@Test
public void noCorrelationIdInContext() {
 final Message message = of(TEST_PAYLOAD);
 final CoreEvent event = InternalEvent.builder(executionContext).message(message).build();
 assertThat(event.getCorrelationId(), is(GENERATED_CORRELATION_ID));
}
org.mule.runtime.core.api.eventCoreEventgetCorrelationId

Popular methods of CoreEvent

  • getMessage
  • builder
    Create new Builder based on an existing CoreEvent instance. The existing EventContext is conserved.
  • getContext
  • getError
  • getVariables
  • getSecurityContext
    The security context for this session. If not null outbound, inbound and/or method invocations will
  • asBindingContext
  • 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
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getSharedPreferences (Context)
  • onCreateOptionsMenu (Activity)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • Socket (java.net)
    Provides a client-side TCP socket.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Github Copilot alternatives
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