java - How to implement a custom SamplingService for a custom message processor?log after that an element is retrieved and before the sequence is performed -
i pretty new in wso2 esb , have implement custom message processor specific behavior: perform operation after element retrieved message store , before sequence related message processor performed.
i try explain in details.
this esb message processor definition:
<?xml version="1.0" encoding="utf-8"?> <!---<messageprocessor class="org.apache.synapse.message.processor.impl.sampler.samplingprocessor" messagestore="transferfrommessagestore" name="transferfrommessageprocessor" xmlns="http://ws.apache.org/ns/synapse">--> <messageprocessor class="com.mycompany.toolkit.messageprocessor.samplingprocessorheaderratelimitation" messagestore="transferfrommessagestore" name="transferfrommessageprocessor" xmlns="http://ws.apache.org/ns/synapse"> <parameter name="sequence">transferprocessorsequence</parameter> <parameter name="interval">1000</parameter> <parameter name="is.active">true</parameter> <parameter name="concurrency">1</parameter> </messageprocessor> it retrieve elements (xml documents) form transferfrommessagestore (a queue) , pass object transferprocessorsequence.xml sequence use it. can see @ time have implemented custom message processor samplingprocessorheaderratelimit extends org.apache.synapse.message.processor.impl.sampler.samplingprocessor wso2 class. @ time show log when init() method performed. deployed on carbon server , works.
here can find entire project code.
ok have understood obtain desired behavior have not extend samplingprocessor class because in order custom implementation between every message consumption , dispatch sequence, need extend class samplingservice class, one.
i think need override execute() or fetch(messageconsumer msgconsumer).
at time should ok insert log, write log file each time element retrieved message store , before sequence related message processor performed.
is possible?
so main main doubs are:
1) have create class extending samplingservice class same project in implementing custom message processor (this behavior have used specific message processor in wso2 esb project, other message processor used in project have use standard samplingservice implementation).
2) doubt related how custom samplingservice implementation passed custom message processor. the samplingprocessor wso2 class (how associate specific custom message processor implementation custom samplingservice implementation handling lifecycle).
1) have create class extending samplingservice class same project in implementing custom message processor (this behavior have used specific message processor in wso2 esb project, other message processor used in project have use standard samplingservice implementation). your custom samplingprocessorheaderratelimitation consume messages coming in transferfrommessagestore , inject messages consumed , processed sequence transferprocessorsequence. other paths not processed message processor.
2) doubt related how custom samplingservice implementation passed custom message processor. the samplingprocessor wso2 class (how associate specific custom message processor implementation custom samplingservice implementation handling lifecycle). if @ source code implemented samplingprocessorheaderratelimitation.gettask() have tied custom samplingservice2 custom samplingprocessorheaderratelimitation
@override protected task gettask() { logger.info("gettask() start"); system.out.println("gettask() start"); logger.info("gettask() end"); system.out.println("gettask() end"); return (task) new samplingservice2(this, synapseenvironment, concurrency, sequence, isprocessorstartasdeactivated()); }
Comments
Post a Comment