class CamelMessage extends Serializable with Product
An immutable representation of a Camel message.
- Source
- CamelMessage.scala
- Alphabetic
- By Inheritance
- CamelMessage
- Product
- Equals
- Serializable
- Serializable
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
- new CamelMessage(body: Any, headers: Map[String, Any])
- new CamelMessage(body: Any, headers: Map[String, Any], attachments: Map[String, DataHandler])
- new CamelMessage(body: Any, headers: Map[String, Any])
- new CamelMessage(body: Any, headers: Map[String, Any], attachments: Map[String, DataHandler])
Value Members
-
def
attachments(names: Set[String]): Map[String, DataHandler]
Returns those attachments from this message whose name is contained in
names
. - val attachments: Map[String, DataHandler]
- val body: Any
-
def
bodyAs[T](implicit t: ClassTag[T], camelContext: CamelContext): T
Returns the body of the message converted to the type
T
.Returns the body of the message converted to the type
T
. Conversion is done using Camel's type converter. The type converter is obtained from the CamelContext that is passed in. The CamelContext is accessible in a akka.camel.javaapi.UntypedConsumerActor and akka.camel.javaapi.UntypedProducerActor using thegetCamelContext
method, and is available on the akka.camel.CamelExtension. -
def
canEqual(that: Any): Boolean
Indicates if some other object can be compared (based on type).
Indicates if some other object can be compared (based on type). This method should be called from every well-designed equals method that is open to be overridden in a subclass.
- Definition Classes
- CamelMessage → Equals
- def copy(body: Any = this.body, headers: Map[String, Any] = this.headers): CamelMessage
-
def
equals(that: Any): Boolean
Indicates whether some other object is "equal to" this one.
Indicates whether some other object is "equal to" this one.
- Definition Classes
- CamelMessage → Equals → AnyRef → Any
-
def
getAttachments: Map[String, DataHandler]
Java API: Returns all attachments from this message.
Java API: Returns all attachments from this message. The returned attachments map is backed up by this message's immutable headers map. Any attempt to modify the returned map will throw an exception.
-
def
getAttachments(names: Set[String]): Map[String, DataHandler]
Java API: Returns those attachments from this message whose name is contained in
names
.Java API: Returns those attachments from this message whose name is contained in
names
. The returned headers map is backed up by an immutable headers map. Any attempt to modify the returned map will throw an exception. -
def
getBodyAs[T](clazz: Class[T], camelContext: CamelContext): T
Java API: Returns the body of the message converted to the type as given by the
clazz
parameter.Java API: Returns the body of the message converted to the type as given by the
clazz
parameter. Conversion is done using Camel's type converter. The type converter is obtained from the CamelContext that is passed in.The CamelContext is accessible in a akka.camel.javaapi.UntypedConsumerActor and akka.camel.javaapi.UntypedProducerActor using the
getCamelContext
method, and is available on the akka.camel.CamelExtension. -
def
getHeaderAs[T](name: String, clazz: Class[T], camelContext: CamelContext): T
Java API: Returns the header by given
name
parameter.Java API: Returns the header by given
name
parameter. The header is converted to typeT
as defined by theclazz
parameter. An exception is thrown when the conversion to the typeT
fails or when the header cannot be found.The CamelContext is accessible in a akka.camel.javaapi.UntypedConsumerActor and akka.camel.javaapi.UntypedProducerActor using the
getCamelContext
method, and is available on the akka.camel.CamelExtension. -
def
getHeaders: Map[String, Any]
Java API: Returns all headers from this message.
Java API: Returns all headers from this message. The returned headers map is backed up by this message's immutable headers map. Any attempt to modify the returned map will throw an exception.
-
def
getHeaders(names: Set[String]): Map[String, Any]
Java API: Returns those headers from this message whose name is contained in
names
.Java API: Returns those headers from this message whose name is contained in
names
. The returned headers map is backed up by an immutable headers map. Any attempt to modify the returned map will throw an exception. -
def
hashCode(): Int
Returns a hash code value for the object.
Returns a hash code value for the object.
- Definition Classes
- CamelMessage → AnyRef → Any
-
def
headerAs[T](name: String)(implicit t: ClassTag[T], camelContext: CamelContext): Try[T]
Returns the header by given
name
parameter in a scala.util.Try.Returns the header by given
name
parameter in a scala.util.Try. The header is converted to typeT
, which is returned in a scala.util.Success. If an exception occurs during the conversion to the typeT
or when the header cannot be found, the exception is returned in a scala.util.Failure.The CamelContext is accessible in a akka.camel.javaapi.UntypedConsumerActor and akka.camel.javaapi.UntypedProducerActor using the
getCamelContext
method, and is available on the akka.camel.CamelExtension. -
def
headers(names: Set[String]): Map[String, Any]
Returns those headers from this message whose name is contained in
names
. - val headers: Map[String, Any]
-
def
mapBody[A, B](transformer: Mapper[A, B]): CamelMessage
Java API: Returns a new CamelMessage with a transformed body using a
transformer
function.Java API: Returns a new CamelMessage with a transformed body using a
transformer
function. This method will throw a java.lang.ClassCastException if the body cannot be mapped to type A. -
def
mapBody[A, B](transformer: (A) ⇒ B): CamelMessage
Returns a new CamelMessage with a transformed body using a
transformer
function.Returns a new CamelMessage with a transformed body using a
transformer
function. This method will throw a java.lang.ClassCastException if the body cannot be mapped to type A. -
def
productArity: Int
Returns the size of this product.
Returns the size of this product.
- Definition Classes
- CamelMessage → Product
-
def
productElement(n: Int): Any
Returns the n-th element of this product, 0-based.
Returns the n-th element of this product, 0-based.
- Definition Classes
- CamelMessage → Product
-
def
productIterator: Iterator[Any]
- Definition Classes
- Product
-
def
productPrefix: String
- Definition Classes
- Product
-
def
resetStreamCache(): Unit
Reset StreamCache body.
Reset StreamCache body. Nothing is done if the body is not a StreamCache. See http://camel.apache.org/stream-caching.html
-
def
toString(): String
- Definition Classes
- CamelMessage → AnyRef → Any
-
def
withAttachments(attachments: Map[String, DataHandler]): CamelMessage
SCALA API: Creates a new CamelMessage with given
attachments
. -
def
withAttachments(attachments: Map[String, DataHandler]): CamelMessage
Java API: Creates a new CamelMessage with given
attachments
.Java API: Creates a new CamelMessage with given
attachments
. A copy of the attachments map is made. -
def
withBody[T](body: T): CamelMessage
Java API: Returns a new CamelMessage with a new body, while keeping the same headers.
-
def
withBodyAs[T](clazz: Class[T])(implicit camelContext: CamelContext): CamelMessage
Java API: Creates a CamelMessage with current
body
converted to typeclazz
.Java API: Creates a CamelMessage with current
body
converted to typeclazz
.The CamelContext is accessible in a akka.camel.javaapi.UntypedConsumerActor and akka.camel.javaapi.UntypedProducerActor using the
getCamelContext
method, and is available on the akka.camel.CamelExtension. -
def
withBodyAs[T](implicit t: ClassTag[T], camelContext: CamelContext): CamelMessage
Creates a CamelMessage with current
body
converted to typeT
.Creates a CamelMessage with current
body
converted to typeT
. The CamelContext is accessible in a akka.camel.javaapi.UntypedConsumerActor and akka.camel.javaapi.UntypedProducerActor using thegetCamelContext
method, and is available on the akka.camel.CamelExtension. -
def
withHeaders[A](headers: Map[String, A]): CamelMessage
Java API: Creates a new CamelMessage with given
headers
.Java API: Creates a new CamelMessage with given
headers
. A copy of the headers map is made.