public class FormattedMetadataDestination extends java.lang.Object implements MessageDrivenDestination
ProduceDestination
that uses String.format(String, Object...)
along with metadata to create a
dynamic destination.
The following rules will apply when you are constructing your formatted destination
String.format(String, Object...)
with no checks.getMetadataKeys()
and getObjectMetadataKeys()
will be
passed into the formatter.
The message in question has the metadata {key1=archive, key2=orders}
and object metadata containing
{timestamp=new Date(1335948092985)}
(the date is roughly "2012-05-02 09:41:23"). The configuration for this
destination contains metadataKeys={key1, key2}, objectMetadataKeys={timestamp}
. then we could use to following
formats for the destination-format to generate output that matches our criteria
ConfiguredProduceDestination
String.format(String, Object...)
,
Formatter
In the adapter configuration file this class is aliased as formatted-metadata-destination which is the preferred alternative to the fully qualified classname when building your configuration.
Constructor and Description |
---|
FormattedMetadataDestination() |
Modifier and Type | Method and Description |
---|---|
void |
addMetadataKey(java.lang.String s) |
void |
addObjectMetadataKey(java.lang.String s) |
java.lang.String |
getDestination(AdaptrisMessage msg)
Returns a
String destination name. |
java.lang.String |
getDestinationTemplate() |
ElementFormatter |
getElementFormatter()
Get the element formatter.
|
java.util.List<java.lang.String> |
getMetadataKeys() |
java.util.List<java.lang.String> |
getObjectMetadataKeys() |
void |
setDestinationTemplate(java.lang.String s) |
void |
setElementFormatter(ElementFormatter elementFormatter)
Set the element formatter.
|
void |
setMetadataKeys(java.util.List<java.lang.String> l) |
void |
setObjectMetadataKeys(java.util.List<java.lang.String> l) |
public void addMetadataKey(java.lang.String s)
public java.util.List<java.lang.String> getMetadataKeys()
public ElementFormatter getElementFormatter()
public void setElementFormatter(ElementFormatter elementFormatter)
elementFormatter
- The element formatter.public void setMetadataKeys(java.util.List<java.lang.String> l)
public void addObjectMetadataKey(java.lang.String s)
public java.util.List<java.lang.String> getObjectMetadataKeys()
public void setObjectMetadataKeys(java.util.List<java.lang.String> l)
public java.lang.String getDestination(AdaptrisMessage msg) throws CoreException
ProduceDestination
Returns a String
destination name. Implementations may or may not use the AdaptrisMessage
to
dynamically generate the name.
getDestination
in interface ProduceDestination
msg
- the AdaptrisMessage
for which the name is being generatedCoreException
- wrapping any underlying Exception
public java.lang.String getDestinationTemplate()
public void setDestinationTemplate(java.lang.String s)