给出:具有 {% if listings %}
{% for listing in listings %}
{% if forloop.counter0|divisibleby:3 %}<div class="row">{% endif %}
<!-- Single Featured Property -->
<div class="col-x-6 col-md-4">
<div class="single-featured-property mb-50">
<!-- Property Thumbnail -->
<div class="property-thumb">
<img src="{{listing.photo_main.url}}" alt="">
<div class="tag">
<span>For Sale</span>
</div>
<div class="list-price">
<p>₹{{listing.price}}</p>
</div>
</div>
<!-- Property Content -->
<div class="property-content">
<h5>{{listing.title}}</h5>
<p class="location"><img src="{% static 'img/icons/location.png'%}" alt="">{{listing.adderss}}</p>
<p>{{listing.description}}</p>
<div class="property-meta-data d-flex align-items-end justify-content-between">
<div class="new-tag">
<img src="{% static 'img/icons/new.png'%}" alt="">
</div>
<div class="bathroom">
<img src="{% static 'img/icons/bathtub.png'%}" alt="">
<span>{{listing.bathrooms}}</span>
</div>
<div class="garage">
<img src="{% static 'img/icons/garage.png'%}" alt="">
<span>{{listing.garage}}</span>
</div>
<div class="space">
<img src="{% static 'img/icons/space.png'%}" alt="">
<span>{{listing.sqft}} sq ft</span>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
{% endif %}
的DSL拓扑。作为 {% if listings %}
<div class="row">
{% for listing in listings %}
<!-- Single Featured Property -->
<div class="col-x-6 col-md-4">
<div class="single-featured-property mb-50">
<!-- Property Thumbnail -->
<div class="property-thumb">
<img src="{{listing.photo_main.url}}" alt="">
<div class="tag">
<span>For Sale</span>
</div>
<div class="list-price">
<p>₹{{listing.price}}</p>
</div>
</div>
<!-- Property Content -->
<div class="property-content">
<h5>{{listing.title}}</h5>
<p class="location"><img src="{% static 'img/icons/location.png'%}" alt="">{{listing.adderss}}</p>
<p>{{listing.description}}</p>
<div class="property-meta-data d-flex align-items-end justify-content-between">
<div class="new-tag">
<img src="{% static 'img/icons/new.png'%}" alt="">
</div>
<div class="bathroom">
<img src="{% static 'img/icons/bathtub.png'%}" alt="">
<span>{{listing.bathrooms}}</span>
</div>
<div class="garage">
<img src="{% static 'img/icons/garage.png'%}" alt="">
<span>{{listing.garage}}</span>
</div>
<div class="space">
<img src="{% static 'img/icons/space.png'%}" alt="">
<span>{{listing.sqft}} sq ft</span>
</div>
</div>
</div>
</div>
</div>
{% if forloop.counter0|divisibleby:3 %}</div>{% endif %}
{% endfor %}
{% endif %}
执行的一部分,从输入一个(KStream::transform
)生成多个消息。
我可能可以从Transformer::transform
返回KeyValue<String, Message>
对象,并将KeyValue<String, List<Message>>
作为拓扑中的下一个处理器来平整列表。但是我想知道是否可以将Transformer::transform
用于同一目标,即
flatMapValues
答案 0 :(得分:1)
来自javadoc of Transformer.transform(K key, V value):
如果应将多个输出记录转发到下游,
ProcessorContext.forward(Object, Object)
和 可以使用ProcessorContext.forward(Object, Object, To)
。请注意,返回新的KeyValue只是为了方便。通过使用
ProcessorContext.forward(Object, Object)
并返回null可以实现相同的目的。