Hi Jins, You're supposed to subclass DoFn and then pass a bunch of information through a constructor. Your URL is a String so it serializes without a problem. Here's an example from the Kettle Beam code: https://github.com/mattcasters/kettle-beam-core/blob/master/src/main/java/org/kettle/beam/core/fn/StringToKettleRowFn.java
So grab the information earlier from the pipeline (or not use the pipeline options like that) and pass it down through a constructor. HTH, Matt --- Matt Casters <m <[email protected]>[email protected]> Senior Solution Architect, Kettle Project Founder Op do 28 feb. 2019 om 09:26 schreef Jins George <[email protected]>: > Hi, > > I am writing a DoFn that writes messages to a mqtt. I was planning to > initialize the mqtt client inside @Setup method, but noticed that > Context/PipelineOptions is not available to the @Setup annotated method. > The mqtt url is supplied as a pipelineOption and it is needed for > initialization. > > Is this intentional not to provide Context/PipelineOptions in @Setup ? > What is the best practice to initialize the client in my case?. ( > startBundle or processElement would be called multiple times, so I didnt > want to write initialization code in there) > > > P.S. I couldn't use the MqttIO as it does not support dynamic topics. > > > Thanks, > > Jins George > > >
