Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message for topic channel feature flag #5161

Merged
merged 3 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions docs/channel.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,7 @@ See also: [channel.fromList](#fromlist) factory method.
This feature requires the `nextflow.preview.topic` feature flag to be enabled.
:::

A *topic* is a channel type introduced as of Nextflow 23.11.0-edge along with {ref}`channel-type-value` and
{ref}`channel-type-queue`.

A *topic channel*, similarly to a *queue channel*, is non-blocking unidirectional FIFO queue, however it connects
multiple *producer* processes with multiple *consumer* processes or operators.
A *topic channel* is a queue channel that can receive values from many source channels *implicitly* based on a matching *topic name*.

:::{tip}
You can think about it as a channel that is shared across many different process using the same *topic name*.
Expand All @@ -498,11 +494,10 @@ input or operator composition as any other Nextflow channel:
channel.topic('my-topic').view()
```

This approach is a convenient way to collect related items from many different sources without explicitly defining
the logic connecting many different queue channels altogether, commonly using the `mix` operator.
This approach is a convenient way to collect related items from many different sources without explicitly connecting them (e.g. using the `mix` operator).

:::{warning}
Any process that consumes a channel topic should not send any outputs to that topic, or else the pipeline will hang forever.
Any process that consumes a topic channel (directly or indirectly) should not send any outputs to that topic, or else the pipeline will hang forever.
:::

See also: {ref}`process-additional-options` for process outputs.
Expand Down
3 changes: 2 additions & 1 deletion modules/nextflow/src/main/groovy/nextflow/Channel.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ class Channel {
}

static DataflowWriteChannel topic(String name) {
if( !NF.topicChannelEnabled ) throw new MissingMethodException('topic', Channel.class, InvokerHelper.EMPTY_ARGS)
if( !NF.topicChannelEnabled )
throw new IllegalStateException("Channel.topic() requires the `nextflow.preview.topic` feature flag")
return CH.topic(name)
}

Expand Down