Suggestions please.

Thinking of options
1. Initilizing spring application context in the 'open' method. Instead of
loading entire context, move service related beans to one/multiple
packages  and scan only those packages. Requires code refactoring.
2. Direct database query - direct query cannot be used since business logic
is around while fetching records
3. Write initially to csv and do transformation on csv. Last possible
option.

Please share your thoughts.

Thank you.

On Wed, Jan 16, 2019 at 2:50 PM madan <madan.yella...@gmail.com> wrote:

> Hi,
>
> Need help in the below scenario,
>
> I have CustomInputFormat which loads the records using a bean,
>
> public class CustomInputFormat extends GenericInputFormat {
>
>       private Iterator<Map<String, Object>> recordsIterator;
>
>       @Override
>
>         public void open(GenericInputSplit split) throws IOException {
>
>                ServiceX serviceX = SpringBeanFinder.getBean(ServiceX.class);
>
>                 recordsIterator = serviceX.getRecords(..);
>
>          }
>
> }
>
> The above input format works fine when using Flink LocalEnvironment in
> spring application. Problem is when running flink in a cluster mode and
> trying to connect to it using RemoveEnvironment. Since Spring applicaiton
> context will not be initialized, NPE is thrown. Please suggest what could
> be the solution in this scenario.
>
>
>
> --
> Thank you,
> Madan.
>


-- 
Thank you,
Madan.

Reply via email to