@Override public CoreEvent process(CoreEvent event) throws MuleException { try { Message msg; Error error = null; String payload = ((InternalEvent) event).getMessageAsString(muleContext); if (payload.indexOf(rejectIfMatches) >= 0) { throw new DefaultMuleException("Saw " + rejectIfMatches); } else if (payload.toLowerCase().indexOf(rejectIfMatches) >= 0) { Exception exception = new Exception(); error = createErrorMock(exception); msg = InternalMessage.builder().nullValue().exceptionPayload(new DefaultExceptionPayload(exception)).build(); } else { msg = of("No " + rejectIfMatches); } CoreEvent muleEvent = eventBuilder(muleContext).message(msg).error(error).build(); return muleEvent; } catch (Exception e) { throw new DefaultMuleException(e); } } }
@Override public CoreEvent process(CoreEvent event) throws MuleException { try { Message msg; Error error = null; String payload = ((InternalEvent) event).getMessageAsString(muleContext); if (payload.indexOf(rejectIfMatches) >= 0) { throw new DefaultMuleException("Saw " + rejectIfMatches); } else if (payload.toLowerCase().indexOf(rejectIfMatches) >= 0) { Exception exception = new Exception(); error = createErrorMock(exception); msg = InternalMessage.builder().nullValue().exceptionPayload(new DefaultExceptionPayload(exception)).build(); } else { msg = of("No " + rejectIfMatches); } CoreEvent muleEvent = eventBuilder(muleContext).message(msg).error(error).build(); return muleEvent; } catch (Exception e) { throw new DefaultMuleException(e); } } }
/** * Creates the event builder from an event context and a flow construct * * @param eventContext Flow construct from where to create the new event */ public EventBuilder(EventContext eventContext) { this.muleEventBuilder = PrivilegedEvent.builder(eventContext); this.muleMessageBuilder = InternalMessage.builder().nullValue(); this.session = new DefaultMuleSession(); }
private CoreEvent createEventWithParameters(CoreEvent event) { CoreEvent.Builder builder = CoreEvent.builder(event.getContext()); builder.message(builder().nullValue().build()); addVariables(event, builder, properties); addVariables(event, builder, parameters); return builder.build(); }
/** * Creates the event builder from a flow construct * * @param location location from where to create the new event */ public EventBuilder(ComponentLocation location) { this.muleEventBuilder = PrivilegedEvent.builder(createEventContext(location)); this.muleMessageBuilder = InternalMessage.builder().nullValue(); this.session = new DefaultMuleSession(); }