Stop executing remaining processor of a pipeline
up vote
1
down vote
favorite
Suppose i have 5 processor in a custom pipeline. I want to abort the execution of remaining processor if certain condition is satisfied in one of the processor.
pipelines
add a comment |
up vote
1
down vote
favorite
Suppose i have 5 processor in a custom pipeline. I want to abort the execution of remaining processor if certain condition is satisfied in one of the processor.
pipelines
1
You can tryargs.AbortPipeline();
when your condition is satisfied. args is the argument parameters you are passing to the pipeline.
– adarsh
23 hours ago
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Suppose i have 5 processor in a custom pipeline. I want to abort the execution of remaining processor if certain condition is satisfied in one of the processor.
pipelines
Suppose i have 5 processor in a custom pipeline. I want to abort the execution of remaining processor if certain condition is satisfied in one of the processor.
pipelines
pipelines
asked 23 hours ago
siddharth
1197
1197
1
You can tryargs.AbortPipeline();
when your condition is satisfied. args is the argument parameters you are passing to the pipeline.
– adarsh
23 hours ago
add a comment |
1
You can tryargs.AbortPipeline();
when your condition is satisfied. args is the argument parameters you are passing to the pipeline.
– adarsh
23 hours ago
1
1
You can try
args.AbortPipeline();
when your condition is satisfied. args is the argument parameters you are passing to the pipeline.– adarsh
23 hours ago
You can try
args.AbortPipeline();
when your condition is satisfied. args is the argument parameters you are passing to the pipeline.– adarsh
23 hours ago
add a comment |
2 Answers
2
active
oldest
votes
up vote
7
down vote
accepted
Siva Kumar answer is correct in the most simple scenario. You must know that
args.AbortPipeline()
doesn't really abort the pipeline. It only sets a flag and all the remaining processors will be still checked and there is a chance some of them WILL be executed. Why?
Sitecore allows setting one extra flag on every processor which is called RunIfAborted
. If you open /sitecore/admin/showconfig.aspx
, you will see this flag set e.g. for 2 processors in publishItem
pipeline:
<publishItem help="Processors should derive from Sitecore.Publishing.Pipelines.PublishItem.PublishItemProcessor">
<!-- ... -->
<processor
type="Sitecore.Publishing.Pipelines.PublishItem.RaiseProcessedEvent, Sitecore.Kernel"
runIfAborted="true"/>
<processor
type="Sitecore.Publishing.Pipelines.PublishItem.UpdateStatistics, Sitecore.Kernel"
runIfAborted="true">
<!-- ... -->
</publishItem>
This flag makes sure that the processors will be executed even if the Aborted
flag is set on the args of the pipeline.
In summary, using args.AbortPipeline();
is the correct way of aborting the execution of pipeline processors, but you must remember that Sitecore may still execute some of the processors.
Pseudo code of how Sitecore pipeline works (this is not the exact code - it's just to show the basic logic part):
foreach (var processor in processors)
{
if (!args.Aborted || processor.RunIfAborted)
Execute(processor);
}
add a comment |
up vote
3
down vote
args.AbortPipeline() method is used to Abort the Pipeline. This method sets _aborted flag as true and ignores the successor processors from execution.
public override void Process(HttpRequestArgs args)
{
Assert.ArgumentNotNull(args, "args");
if (condition is true)
{
args.AbortPipeline();
return;
}
}
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
7
down vote
accepted
Siva Kumar answer is correct in the most simple scenario. You must know that
args.AbortPipeline()
doesn't really abort the pipeline. It only sets a flag and all the remaining processors will be still checked and there is a chance some of them WILL be executed. Why?
Sitecore allows setting one extra flag on every processor which is called RunIfAborted
. If you open /sitecore/admin/showconfig.aspx
, you will see this flag set e.g. for 2 processors in publishItem
pipeline:
<publishItem help="Processors should derive from Sitecore.Publishing.Pipelines.PublishItem.PublishItemProcessor">
<!-- ... -->
<processor
type="Sitecore.Publishing.Pipelines.PublishItem.RaiseProcessedEvent, Sitecore.Kernel"
runIfAborted="true"/>
<processor
type="Sitecore.Publishing.Pipelines.PublishItem.UpdateStatistics, Sitecore.Kernel"
runIfAborted="true">
<!-- ... -->
</publishItem>
This flag makes sure that the processors will be executed even if the Aborted
flag is set on the args of the pipeline.
In summary, using args.AbortPipeline();
is the correct way of aborting the execution of pipeline processors, but you must remember that Sitecore may still execute some of the processors.
Pseudo code of how Sitecore pipeline works (this is not the exact code - it's just to show the basic logic part):
foreach (var processor in processors)
{
if (!args.Aborted || processor.RunIfAborted)
Execute(processor);
}
add a comment |
up vote
7
down vote
accepted
Siva Kumar answer is correct in the most simple scenario. You must know that
args.AbortPipeline()
doesn't really abort the pipeline. It only sets a flag and all the remaining processors will be still checked and there is a chance some of them WILL be executed. Why?
Sitecore allows setting one extra flag on every processor which is called RunIfAborted
. If you open /sitecore/admin/showconfig.aspx
, you will see this flag set e.g. for 2 processors in publishItem
pipeline:
<publishItem help="Processors should derive from Sitecore.Publishing.Pipelines.PublishItem.PublishItemProcessor">
<!-- ... -->
<processor
type="Sitecore.Publishing.Pipelines.PublishItem.RaiseProcessedEvent, Sitecore.Kernel"
runIfAborted="true"/>
<processor
type="Sitecore.Publishing.Pipelines.PublishItem.UpdateStatistics, Sitecore.Kernel"
runIfAborted="true">
<!-- ... -->
</publishItem>
This flag makes sure that the processors will be executed even if the Aborted
flag is set on the args of the pipeline.
In summary, using args.AbortPipeline();
is the correct way of aborting the execution of pipeline processors, but you must remember that Sitecore may still execute some of the processors.
Pseudo code of how Sitecore pipeline works (this is not the exact code - it's just to show the basic logic part):
foreach (var processor in processors)
{
if (!args.Aborted || processor.RunIfAborted)
Execute(processor);
}
add a comment |
up vote
7
down vote
accepted
up vote
7
down vote
accepted
Siva Kumar answer is correct in the most simple scenario. You must know that
args.AbortPipeline()
doesn't really abort the pipeline. It only sets a flag and all the remaining processors will be still checked and there is a chance some of them WILL be executed. Why?
Sitecore allows setting one extra flag on every processor which is called RunIfAborted
. If you open /sitecore/admin/showconfig.aspx
, you will see this flag set e.g. for 2 processors in publishItem
pipeline:
<publishItem help="Processors should derive from Sitecore.Publishing.Pipelines.PublishItem.PublishItemProcessor">
<!-- ... -->
<processor
type="Sitecore.Publishing.Pipelines.PublishItem.RaiseProcessedEvent, Sitecore.Kernel"
runIfAborted="true"/>
<processor
type="Sitecore.Publishing.Pipelines.PublishItem.UpdateStatistics, Sitecore.Kernel"
runIfAborted="true">
<!-- ... -->
</publishItem>
This flag makes sure that the processors will be executed even if the Aborted
flag is set on the args of the pipeline.
In summary, using args.AbortPipeline();
is the correct way of aborting the execution of pipeline processors, but you must remember that Sitecore may still execute some of the processors.
Pseudo code of how Sitecore pipeline works (this is not the exact code - it's just to show the basic logic part):
foreach (var processor in processors)
{
if (!args.Aborted || processor.RunIfAborted)
Execute(processor);
}
Siva Kumar answer is correct in the most simple scenario. You must know that
args.AbortPipeline()
doesn't really abort the pipeline. It only sets a flag and all the remaining processors will be still checked and there is a chance some of them WILL be executed. Why?
Sitecore allows setting one extra flag on every processor which is called RunIfAborted
. If you open /sitecore/admin/showconfig.aspx
, you will see this flag set e.g. for 2 processors in publishItem
pipeline:
<publishItem help="Processors should derive from Sitecore.Publishing.Pipelines.PublishItem.PublishItemProcessor">
<!-- ... -->
<processor
type="Sitecore.Publishing.Pipelines.PublishItem.RaiseProcessedEvent, Sitecore.Kernel"
runIfAborted="true"/>
<processor
type="Sitecore.Publishing.Pipelines.PublishItem.UpdateStatistics, Sitecore.Kernel"
runIfAborted="true">
<!-- ... -->
</publishItem>
This flag makes sure that the processors will be executed even if the Aborted
flag is set on the args of the pipeline.
In summary, using args.AbortPipeline();
is the correct way of aborting the execution of pipeline processors, but you must remember that Sitecore may still execute some of the processors.
Pseudo code of how Sitecore pipeline works (this is not the exact code - it's just to show the basic logic part):
foreach (var processor in processors)
{
if (!args.Aborted || processor.RunIfAborted)
Execute(processor);
}
edited 19 hours ago
answered 22 hours ago
Marek Musielak
9,19811034
9,19811034
add a comment |
add a comment |
up vote
3
down vote
args.AbortPipeline() method is used to Abort the Pipeline. This method sets _aborted flag as true and ignores the successor processors from execution.
public override void Process(HttpRequestArgs args)
{
Assert.ArgumentNotNull(args, "args");
if (condition is true)
{
args.AbortPipeline();
return;
}
}
add a comment |
up vote
3
down vote
args.AbortPipeline() method is used to Abort the Pipeline. This method sets _aborted flag as true and ignores the successor processors from execution.
public override void Process(HttpRequestArgs args)
{
Assert.ArgumentNotNull(args, "args");
if (condition is true)
{
args.AbortPipeline();
return;
}
}
add a comment |
up vote
3
down vote
up vote
3
down vote
args.AbortPipeline() method is used to Abort the Pipeline. This method sets _aborted flag as true and ignores the successor processors from execution.
public override void Process(HttpRequestArgs args)
{
Assert.ArgumentNotNull(args, "args");
if (condition is true)
{
args.AbortPipeline();
return;
}
}
args.AbortPipeline() method is used to Abort the Pipeline. This method sets _aborted flag as true and ignores the successor processors from execution.
public override void Process(HttpRequestArgs args)
{
Assert.ArgumentNotNull(args, "args");
if (condition is true)
{
args.AbortPipeline();
return;
}
}
answered 23 hours ago
Siva Kumar
767
767
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f15088%2fstop-executing-remaining-processor-of-a-pipeline%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You can try
args.AbortPipeline();
when your condition is satisfied. args is the argument parameters you are passing to the pipeline.– adarsh
23 hours ago