Trying to kill a task from outside the task, can't find a kill() method

is there a way to kill a task from outside the task?

I’m only guessing that this is a task thing and not a NATS thing, and
there seems to be no kill() method, but if kill() only doesn’t work for NATS
then I’ll reissue the question on the NATS github
thank you in advance,

using NATS

sub = NATS.subscribe(nc, subject)

sub_task = @async for msg in sub

println("msg="," ",msg)


I think that killing Tasks isn’t proper. I suppose you should rather communicate to the Task that it should exit using a Channel, or otherwise synchronize using, for example, Semaphores.

Furthermore, I think you’re a bit confused about what Tasks are/do, they’re just coroutines: Tasks · The Julia Language

So they don’t run in parallel. Maybe you want threads or processes instead of Tasks.