I created a diagram that included a SELECT block using SelNthItem, such as:
- Code: Select all
<description>SELECT</description>
<blockclassname>C:\FlowBasedProgramming\JavaFBP-2.5.jar!com.jpmorrsn.fbp.components.SelNthItem</blockclassname>
On testing, the ACC output went to a ShowText window, but my REJ output to the console was empty:
- Code: Select all
C:\FlowBasedProgramming>set CLASSPATH=.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip;.;C:\FlowBasedProgamming\JavaFBP-2.5.jar
C:\FlowBasedProgramming>java bob/SimpleSortContents
Run complete. Time: 0.328 seconds
C:\FlowBasedProgramming>
I extracted SelNthItem.java from the jar file and was able to make the REJ port send data. Here are the changes (lines with < at the beginning):
- Code: Select all
< package bob;
---
> package com.jpmorrsn.fbp.components;
< * Bob, November 2011: Make REJ port optional, and update the description.
< */
< @ComponentDescription("Select from IN one packet by NUMBER (0 means first), sending via ACC, rejected packets via REJ")
< @OutPorts( { @OutPort(value = "ACC"), @OutPort(value = "REJ", optional = true) })
---
> */
> @ComponentDescription("Select a specific item from a stream by number")
> @OutPorts( { @OutPort(value = "ACC"), @OutPort(value = "REJ") })
< rejport.send(p);
< //drop(p); // undo "fudge to save space"
---
> //rejport.send(p);
> drop(p); // fudge to save space
Using this component instead seemed to work: I had correct output in a window and on the console.
HTH
Bob