001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.camel.spi; 018 019import org.apache.camel.CamelContextAware; 020import org.apache.camel.Exchange; 021import org.apache.camel.MessageHistory; 022import org.apache.camel.NamedNode; 023import org.apache.camel.StaticService; 024 025/** 026 * A factory to create {@link MessageHistory} instances. 027 */ 028public interface MessageHistoryFactory extends StaticService, CamelContextAware { 029 030 /** 031 * Creates a new {@link MessageHistory} 032 * 033 * @param routeId the route id 034 * @param node the node in the route 035 * @param timestamp the time the message processed at this node. 036 * @param exchange the current exchange 037 * @return a new {@link MessageHistory} 038 */ 039 MessageHistory newMessageHistory(String routeId, NamedNode node, long timestamp, Exchange exchange); 040 041 boolean isCopyMessage(); 042 043 /** 044 * Sets whether to make a copy of the message in the {@link MessageHistory}. 045 * By default this is turned off. Beware that you should not mutate or change the content 046 * on the copied message, as its purpose is as a read-only view of the message. 047 */ 048 void setCopyMessage(boolean copyMessage); 049 050 String getNodePattern(); 051 052 /** 053 * An optional pattern to filter which nodes to trace in this message history. By default all nodes are included. 054 * To only include nodes that are Step EIPs then use the EIP shortname, eg step. 055 * You can also include multiple nodes separated by comma, eg step,wiretap,to 056 */ 057 void setNodePattern(String nodePattern); 058 059}