You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by 苏喜 张 <15...@163.com> on 2021/03/08 06:11:40 UTC

How do I call an algorithm written in C++ in Flink?

The company has provided an algorithm written in C++, which has been packaged into a.so file. I have built a SpringBoot project, which uses JNI to operate the algorithm written in C++. Could you please tell me how to call it in Flink? Do i need to define operators, chains of operators?


Re: How do I call an algorithm written in C++ in Flink?

Posted by Arvid Heise <ar...@apache.org>.
Hi Suxi,

to expand a bit on the answer of Yun: it depends on which kind of algorithm
do you have. If you want to apply your C++ function to each record, then
you can go Yun's way and use a RichMapFunction to load your library and
invoke it for each record in map. If you need more records, then you need
to group then accordingly.

If you give us more details, we can help you figure it out. I'd be
especially interested to understand why you want to use Flink in the first
place.

Best,

Arvid

On Mon, Mar 8, 2021 at 10:48 AM Yun Gao <yu...@aliyun.com> wrote:

> Hi Suxi,
>
> Do you mean you want to call the algorithm in C++ ? If so, I think you
> could
> do it the same with as you wrap it in SpringBoot project via JNI. I think
> you
> do not need to add a new operator, and you could use existing Flink API,
> and
> you could load you library in open() and call the algorithm in the
> following
> processing method.
>
> Best,
> Yun
>
>
> ------------------Original Mail ------------------
> *Sender:*苏喜 张 <15...@163.com>
> *Send Date:*Mon Mar 8 14:12:02 2021
> *Recipients:*user@flink.apache.org <us...@flink.apache.org>
> *Subject:*How do I call an algorithm written in C++ in Flink?
>
>> The company has provided an algorithm written in C++, which has been
>> packaged into a.so file. I have built a SpringBoot project, which uses JNI
>> to operate the algorithm written in C++. Could you please tell me how to
>> call it in Flink? Do i need to define operators, chains of operators?
>>
>>
>>
>

Re: How do I call an algorithm written in C++ in Flink?

Posted by Yun Gao <yu...@aliyun.com>.
Hi Suxi,

Do you mean you want to call the algorithm in C++ ? If so, I think you could
do it the same with as you wrap it in SpringBoot project via JNI. I think you 
do not need to add a new operator, and you could use existing Flink API, and
you could load you library in open() and call the algorithm in the following 
processing method.

Best,
Yun



 ------------------Original Mail ------------------
Sender:苏喜 张 <15...@163.com>
Send Date:Mon Mar 8 14:12:02 2021
Recipients:user@flink.apache.org <us...@flink.apache.org>
Subject:How do I call an algorithm written in C++ in Flink?

The company has provided an algorithm written in C++, which has been packaged into a.so file. I have built a SpringBoot project, which uses JNI to operate the algorithm written in C++. Could you please tell me how to call it in Flink? Do i need to define operators, chains of operators?