I would like to know few things about Camel Headers
what are the pros and cons of setting too many headers in camel Exchange?
what are the pros and cons of setting too large headers in camel Exchange?
解决方案
If you have too many or too large, then by definition there will be problems. But let's consider simply many and large instead.
Many Headers
The headers in Camel are held in a java.util.TreeMap, so there may be some performance characteristics to consider with this data structure. Perhaps there may be an issue if many headers are added all at once in their natural order, as the tree would need to rebalance several times. Also, keep in mind that searching for a specific header would be a O(log n) operation, so there could be efficiency issues if multiple queries of specific headers occur.
Large Headers
By themselves, large headers don't necessarily cause any problems. The issues which arise are in systems where there are several exchanges, each with separate large object needing to be manipulated. It's taxing on the system to hold all these things in memory, but not because of any deficiency of Camel.
That said, it would be atypical to have truly large headers. Typically, if you need to process large objects in Camel, it is better to have them as streams in the body of the message.