How to use groups in NoFlo?

The NoFlo Components documentation mentions groups, but does not explain what they are used for and how they should be used.

Can someone explain what role groups play in NoFlo, how to use groups and nested groups, and how they affect asynchronous components?

+4
source share
1 answer

The concept of groups is described as β€œIP address brackets” in the FBP book .

Basically, begingroupthey endgroupare special types of packets that indicate that data packets transmitted between them contain this group as metadata.

Think of it a bit like XML:

<somegroup>
  <innergroup>
    data
  </innergroup>
</somegroup>

In NoFlo, this will work with:

@outPorts.out.beginGroup 'somegroup'
@outPorts.out.beginGroup 'innergroup'
@outPorts.out.send "data"
@outPorts.out.endGroup()
@outPorts.out.endGroup()

inport begingroup endgroup - , . , , , , , .

@inPorts.in.on 'begingroup', (group) =>
  @outPorts.out.beginGroup group
@inPorts.in.on 'data', (data) =>
  # do something and then send
@inPorts.in.on 'endgroup', =>
  @outPorts.out.endGroup()

, "" . , NoFlo, filesystem/ReadFile , .

- . , webserver/Server . , .

+3

Source: https://habr.com/ru/post/1539582/


All Articles