Can we enrich the header as a POJO for RabbitMQ in Spring Integration? -
i using pojo in header enrichment of rabbitmq. can that? after enriching header consumer of queue header? configuration follows:
<integration:chain input-channel="queechannel" > <integration:header-enricher> <integration:header name="myheader" ref="mybean" method="mymethod"></integration:header> </integration:header-enricher> <integration:recipient-list-router apply-sequence="true"> <integration:recipient channel="mqchannel"/> </integration:recipient-list-router> </integration:chain>
any non-standard headers must supplied header-mapper on <int-amqp:outbound-channel-adapter> (or messagepostprocessor in case of direct rabbittemplate usage). should accepted on consumer side (<int-amqp:inbound-channel-adapter mapped-request-headers="myheader">).
what bad isn't enough. amqp protocol (as wire protocol) can deal standard object types (defaultmessagepropertiesconverter):
boolean valid = (value instanceof string) || (value instanceof byte[]) || (value instanceof boolean) || (value instanceof longstring) || (value instanceof integer) || (value instanceof long) || (value instanceof float) || (value instanceof double) || (value instanceof bigdecimal) || (value instanceof short) || (value instanceof byte) || (value instanceof date) || (value instanceof list) || (value instanceof map); if (!valid && value != null) { value = value.tostring(); } so, pojo header treated string.
so, sure logic enough convenient.
Comments
Post a Comment