Codota Logo
CoreEvent.getCorrelationId
Code IndexAdd Codota 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)

  • Common ways to obtain CoreEvent
private void myMethod () {
CoreEvent c =
  • Codota IconCoreEvent.Builder eventBuilder;eventBuilder.build()
  • Codota IconMuleContextUtils muleContextUtils;MuleContext muleContext;MuleContextUtils muleContextUtils2;Object object;muleContextUtils.eventBuilder(muleContext).message(muleContextUtils2.of(object)).build()
  • Smart code suggestions by Codota
}
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 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 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 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
  • getContext
  • getError
  • getVariables
  • getSecurityContext
  • asBindingContext
  • getFlowCallStack
  • getItemSequenceInfo
  • getAuthentication
  • getGroupCorrelation
  • 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

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • getSharedPreferences (Context)
  • getSystemService (Context)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • StringTokenizer (java.util)
    The string tokenizer class allows an application to break a string into tokens. The tokenization met
  • DataSource (javax.sql)
    A factory for connections to the physical data source that this DataSource object represents. An alt
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registery of org.quartz
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now