-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
- From my understanding, you can emit as many records as you wish.
However, you need to use ProcessorContext#forward() for this.
The return type of transform() MUST always be "KeyValue".
Thus, you would do something link this:
> new Transformer() { private ProcessorContext context;
>
> void init(ProcessorContext context) { this.context = context; }
>
> KeyValue transform(K key, V value) { context.forward(new
> KeyValue(...)); context.forward(new KeyValue(...));
>
> return null; // don't need to emit anything else -- you can also
> return "new KeyValue()" here in addition to context.forward } }
Please let me know if this works.
- -Matthias
On 11/10/16 10:19 AM, Michael Noll wrote:
> Shannon,
>
> as Eno said, yes, this is possible. The "caveat" that Eno
> mentioned is that you'd always have to return a list of results,
> e.g. a list containing a single element when there's just a single
> output message to return.
>
> Does that answer your question?
>
>
>
> On Thu, Nov 10, 2016 at 6:44 PM, Eno Thereska
> <
eno.th...@gmail.com <mailto:
eno.th...@gmail.com>> wrote:
>
> I think I might have misunderstood your question. If you have to
> operate with return type of KeyValue<String, GenericRecord>, then
> you have to use that return type. However, if you want to define a
> different return type (eg a list) that's doeable but then you have
> to keep using that return. See
>
https://github.com/apache/kafka/blob/trunk/streams/src/test/java/org/a
pache/kafka/streams/kstream/internals/KStreamTransformTest.java#L57
>
>
<
https://github.com/apache/kafka/blob/trunk/streams/src/test/java/org/ap
ache/kafka/streams/kstream/internals/KStreamTransformTest.java#L57>.
>
> Eno
>
> On Thursday, 10 November 2016 17:39:43 UTC, Eno Thereska wrote:
>
> Unfortunately I don't think it's possible currently.
>
> Eno
>
> On Thursday, 10 November 2016 16:13:05 UTC, Shannon Ma wrote:
>
> Hi,
>
> I am wondering if this is possible, in my kafka stream transform
> logic, based on the input message, sometimes i need to return two
> output messages, so instead of
>
>
> KeyValue<String, GenericRecord> transform(String key, GenericRecord
> value)
>
> can i do something like
>
>
> List<KeyValue<String, GenericRecord>> transform(String key,
> GenericRecord value) {
>
>
> Thanks Shannon
>
> -- You received this message because you are subscribed to the
> Google Groups "Confluent Platform" group. To unsubscribe from this
> group and stop receiving emails from it, send an email to
>
confluent-platf...@googlegroups.com
> <mailto:
confluent-platf...@googlegroups.com>. To post
> to this group, send email to
confluent...@googlegroups.com
> <mailto:
confluent...@googlegroups.com>. To view this
<
https://groups.google.com/d/msgid/confluent-platform/670aa53f-1e7b-46dd
- -a137-e2c4f44996d3%
40googlegroups.com?utm_medium=email&utm_source=footer
>.
> <
https://groups.google.com/d/optout>.
>
>
>
>
> -- *Michael G. Noll* Product Manager | Confluent
+1 650 453 5860 |
> @miguno <
https://twitter.com/miguno> Follow us: Twitter
> <
https://twitter.com/ConfluentInc> | Blog
> <
http://www.confluent.io/blog>
>
> -- You received this message because you are subscribed to the
> Google Groups "Confluent Platform" group. To unsubscribe from this
> group and stop receiving emails from it, send an email to
>
confluent-platf...@googlegroups.com
> <mailto:
confluent-platf...@googlegroups.com>. To post
> to this group, send email to
confluent...@googlegroups.com
> <mailto:
confluent...@googlegroups.com>. To view this
> discussion on the web visit
>
https://groups.google.com/d/msgid/confluent-platform/CAA4zQxKMMoQrEc4z
okr3jYZRFMcwQ78XboZYhSiopW7cF78rXw%
40mail.gmail.com
>
>
<
https://groups.google.com/d/msgid/confluent-platform/CAA4zQxKMMoQrEc4zo
kr3jYZRFMcwQ78XboZYhSiopW7cF78rXw%
40mail.gmail.com?utm_medium=email&utm_
source=footer>.
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools -
https://gpgtools.org
iQIcBAEBCgAGBQJYJM5LAAoJECnhiMLycopPHiIQAI4Rv5PUIGOCVIiFDl0BTmOy
FgD8xHPagQ5VkA5vBdnZv1wHzlYiIMiSdH/HfXOyTCMFNE7cF8Cz3BFNvTeju14r
gpY0OoNIekBTCNy7cqtwYnBhbviFPo478GjpWl2U3q2EpBSp5ufg9V4gVI7e6c/s
/JQvDyIE5xk9tq/O1NYDts/6fmvV9WatWa3374CGzdynFf4xcgg240aU3MZObpdr
3PtA7rTD8FGjh7xx0J3UpV3xeOU66IX5dzxK0b73JedaXyulGau+ejRSZ3hcn7pT
hhjRXC+3CXj5i5NVi561MZamz5cps60BHy7D9JeAnnJPLSwB7C5qCzv2Q1E26Iyh
kUrD9AKuOhEVJxR3t+DTc4NIDCrKVD7upsBZhVNLigKUPJExMx5l7OwAR2K95fag
T1jd/SioGhUxvk+EMj0fc8nBaZOJDYxCv3Jz5og5osHQqTJ8ZDjV1IA4KfPdX+37
XZ9fqrSBMkrn/vTF9WsF2PtJXzLezzItYwT769ilTc2GT9EbaPCQEJF9p8m2q/gr
e8UHirdxDNLI2N+RJT25yhwNyfK+EX/QS7QZlJzDBxV2TiCgUatOraMJr4j48V1W
VueJLBroLIYhWtpER4j7JgX/+foZx8CmpRJY2HngyuCJToEs/8ZlVbniihqw/jS5
vz4ievTDOBbed0Q5wkL1
=WZxD
-----END PGP SIGNATURE-----