Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel;
import java.util.Map;
import java.util.function.Supplier;
import org.apache.camel.spi.HeadersMapFactory;
import org.apache.camel.trait.message.MessageTrait;
/**
* Implements the Message pattern and represents an inbound or
* outbound message as part of an {@link Exchange}.
*
* Headers are represented in Camel using a {@link org.apache.camel.util.CaseInsensitiveMap CaseInsensitiveMap}. The
* implementation of the map can be configured by the {@link HeadersMapFactory} which can be set on the
* {@link CamelContext}. The default implementation uses the {@link org.apache.camel.util.CaseInsensitiveMap
* CaseInsensitiveMap}.
*/
public interface Message {
/**
* Clears the message from user data, so the message can be reused.
*
* Important: This API is NOT intended for Camel end users, but used internally by Camel itself.
*/
void reset();
/**
* Returns the id of the message.
*
* By default, the message uses the same id as {@link Exchange#getExchangeId()} as messages are associated with the
* exchange and using different IDs does not offer much value. Another reason is to optimize for performance to
* avoid generating new IDs.
*
* A few Camel components do provide their own message IDs such as the JMS components.
*
* @return the message id
*/
String getMessageId();
/**
* Returns the timestamp that this messages originates from.
*
* Some systems like JMS, Kafka, AWS have a timestamp on the event/message, that Camel received. This method returns
* the timestamp, if a timestamp exists.
*
* The message timestamp and exchange created are not the same. An exchange always have a created timestamp which is
* the local timestamp when Camel created the exchange. The message timestamp is only available in some Camel
* components when the consumer is able to extract the timestamp from the source event.
*
* @return the timestamp, or 0 if the message has no source timestamp.
* @see Exchange#getClock()
*/
long getMessageTimestamp();
/**
* Sets the id of the message
*
* @param messageId id of the message
*/
void setMessageId(String messageId);
/**
* Whether the message has any message ID assigned.
*/
boolean hasMessageId();
/**
* Returns the exchange this message is related to
*
* @return the exchange
*/
Exchange getExchange();
/**
* Accesses a specific header
*
* @param name name of header
* @return the value of the given header or null if there is no header for the given name
*/
Object getHeader(String name);
/**
* Accesses a specific header
*
* @param name name of header
* @param defaultValue the default value to return if header was absent
* @return the value of the given header or defaultValue if there is no header for the given
* name
*/
Object getHeader(String name, Object defaultValue);
/**
* Accesses a specific header
*
* @param name name of header
* @param defaultValueSupplier the default value supplier used to generate the value to return if header was absent
* @return the value of the given header or the value generated by the
* defaultValueSupplier if there is no header for the given name
*/
Object getHeader(String name, Supplier