Hi Anakit. From a processor you can control whatever your relationships are for 
down stream processors. This can be achieved by a few steps.

Create a static relationship reference within your processor. For example, if 
you want to handle success and failure routing behaviour

    static final Relationship REL_SUCCESS = new Relationship.Builder()
            .name("success")
            .description("Your process succeeds")
            .build();
    static final Relationship REL_FAILURE = new Relationship.Builder()
            .name("failure")
            .description("Something within the process failed.")
            .build();

    private static final Set<Relationship> RELATIONSHIPS;

    static {
        // ..
        Set<Relationship> r = new HashSet<>();
        r.add(REL_SUCCESS);
        r.add(REL_FAILURE);
        RELATIONSHIPS = Collections.unmodifiableSet(r);
    }

Now in your trigger method you can route to any of these relationships.

    @Override
    public void onTrigger(ProcessContext pc, ProcessSession ps) throws 
ProcessException {
        final FlowFile ff = ps.get();
        if (ff == null) {
            return;
        }

        try {
            // do something.
            ps.transfer(ff, REL_SUCCESS);
        } catch (Throwable t) {
            // if something fails
            ps.transfer(ff, REL_FAILURE);
        }
    }

While this demonstrates failing from an exception, you can fail from anywhere 
you like.

You can also have as many relationships as you like, well; I'm not sure on the 
practical and allowable limitations.

> On 8 Jan 2018, at 20:40, Ankit Dhar <[email protected]> wrote:
> 
> Hi team,
>    I have a jar which does one operation .
> Like it fetches the csv file and processes it.
> My problem is I want to know weather the jar worked or it didn't , So is
> there any option in nifi, So  that I can check weather the execution was
> successful or not
> 
> Thanks in Advance.
> 
> --
> ankit

Attachment: signature.asc
Description: Message signed with OpenPGP

Reply via email to