// @Override public MuleEvent[] process(MuleEvent event) throws MessagingException { String eventComponentName = event.getService().getName(); if (!assignedComponentName.equals(eventComponentName)) { IllegalArgumentException iex = new IllegalArgumentException( "This receiver is assigned to service: " + assignedComponentName + " but has received an event for service: " + eventComponentName + ". Please check your config to make sure each service" + "has its own instance of IdempotentReceiver."); throw new RoutingException(event.getMessage(), event.getEndpoint(), iex); } Object id = this.getIdForEvent(event); try { if (idStore.storeId(id)) { return new MuleEvent[] {event}; } else { return null; } } catch (Exception e) { throw new RoutingException( CoreMessages.failedToWriteMessageToStore(id, assignedComponentName), event.getMessage(), event.getEndpoint(), e); } }
// @Override public boolean isMatch(MuleEvent event) throws MessagingException { if (idStore == null) { // we need to load this on the first request as we need the service name synchronized (this) { this.initialize(event); } } try { return !idStore.containsId(this.getIdForEvent(event)); } catch (Exception ex) { throw new RoutingException(event.getMessage(), event.getEndpoint(), ex); } }