支援条件のサブプロセスを追加し、0.0.6のリリースをstepchain

ログの更新ログを更新します。

0.0.6はIConditionSelector IConditionValidator \ IConditionLoopProcessor条件分支場合/他、急がせる、ループ子流程を追加します。

gitee:  https://gitee.com/zengfr/stepchain

githubの:  https://github.com/zengfr/stepchain-spring-boot-starter/

リポジトリ中央Sonatype Mvnrepository

特徴:
1、ユニバーサルサービスの仕事をサポートし、サービスのサブプロセス無制限分割。
図2に示すように、サブサポートビジネスプロセスのシリアル化、並列ビジネスサブプロセス、廃棄されてもよいです。
図3は、有効化または無効化、シリアルまたはパラレルの統一構成と並列の数を設定するコンフィグビジネスサブプロセスをサポートします。
4、ビジネスプロセスとサブプロセスの任意無制限のネストをサポートしています。
5、サポートセンターの設定、キャッシュ、統一されたデータ・インタフェース、Redisの、エス、その上のトレースとは、ログに記録します。
図6は、条件分岐のif /他、急がせる、ループサブプロセスをサポートしています。
NOTE:のみ(使用には影響しない)の共通部分を開いて、該当するフレームアセンブリを加えて構成するには、次のパートのAPI構成センター、キャッシュ・センター、データ・インタフェースおよびビジネス関連DataMiddleなど。
Mavenの依存関係:
Mavenの(春ブーツを使用しない):
<依存> 
 <groupIdを> com.github.zengfr.project </ groupIdを> 
 <たartifactId> stepchain </たartifactId> 
 <バージョン> 0.0.6 </バージョン> 
<依存> 
Mavenの(使用スプリングブート):
<依存性> 
 <のgroupId> com.github.zengfr.project </のgroupId> 
 <たartifactId> stepchainスプリングブートスタータ</たartifactId> 
 <バージョン> 0.0.6 </バージョン> 
<依存性> 
Gradleのは:
'com.github.zengfr.project'、名前: 'stepchain'、バージョン'0.0.5'グループコンパイル
コンパイルグループ: 'com.github.zengfr.project'、名前を「stepchainスプリング-boot-をスターター'、バージョン:0。0.5'

パイプラインChainBuilder StepBuilderステップチェーンインタフェース  のJavadoc APIを文档 stepchain-UMLクラス

public interface Step<I> extends StepProcessor<I> {
	void put(StepProcessor<I> processor);

	void put(StepProcessor<I>... processorArray);

	void put(Collection<StepProcessor<I>> processors);

	void put(Processor<I, Boolean> processor);

	void put(Processor<I, Boolean>... processorArray);

	void put(Chain<I, Boolean> chain);

	void put(Chain<I, Boolean>... processorArray);

	void put(Function<I, Boolean> func);

	void put(Function<I, Boolean>... processorArray);
}
public interface Chain<A, B> extends Processor<A, B> {
	<C> Chain<A, C> next(Processor<B, C> process);

	<C> Chain<A, C> next(Function<B, C> func);
}
public interface ChainBuilder {
	<A, B> Chain<A, B> createChain(Function<A, B> func);

	<A, B> Chain<A, B> createChain(Processor<A, B> processor);

	<A, B, C> Chain<A, C> createChain(Processor<A, B> processor1, Processor<B, C> processor2);
}
public interface StepBuilder {
	<T> Step<T> createStep();

	<T> Step<T> createStep(int parallelCount);

	<T> Step<T> createStep(String parallelCountConfigName);
}

StepChainSpringBootTest.java

PipelineTest.java 
Demo&Test you can use AbstractProcessor AbstractStepProcessor

import com.github.zengfr.project.stepchain
abstract class AbstractProcessor<I, O> implements Processor<I, O>{}
abstract class AbstractStepProcessor<A> extends AbstractProcessor<A, Boolean> implements StepProcessor<A>{}
import com.github.zengfr.project.stepchain.Chain;
import com.github.zengfr.project.stepchain.Pipeline;
import com.github.zengfr.project.stepchain.Step;
import com.github.zengfr.project.stepchain.context.ContextBuilder;
import com.github.zengfr.project.stepchain.context.UnaryContext;
import com.github.zengfr.project.stepchain.test.context.SetProductContext;
import com.github.zengfr.project.stepchain.test.context.SetProductDataMiddle;
import com.github.zengfr.project.stepchain.test.processor.DiscountProcessor;
import com.github.zengfr.project.stepchain.test.processor.FeeProcessor;
import com.github.zengfr.project.stepchain.test.processor.IncreaseProcessor;
import com.github.zengfr.project.stepchain.test.processor.InitProcessor;
import com.github.zengfr.project.stepchain.test.processor.TaxProcessor;

public class PipelineTest {
public static void testPipeline(IPipeline pipeline) throws Exception {
    //Demo精简版 只开源了通用部分(不影响使用)
	SetProductRequest req = new SetProductRequest();
	SetProductResponse resp = new SetProductResponse();
	SetProductDataMiddle middle = new SetProductDataMiddle();

	SetProductContext context = new SetProductContext(req, middle, resp);
	IStep<SetProductContext> step = pipeline.createStep();
	step.put(new InitProcessor());
	step.put(new TaxProcessor());
	step.put(new FeeProcessor());
	step.put(new IncreaseProcessor());
	step.put(new DiscountProcessor());
	step.put((c) -> {
		c.middle.Price += 10;
		return true;
	});
	step.process(context);
	System.out.println(context.middle.Price);
	}

	public static void testPipeline2(IPipeline pipeline) throws Exception {
	Function<UnaryContext<Integer>, Boolean> func = (context) -> {
		if (context.context == null)
		context.context = 1;
		context.context += 1;
		return true;

	};
	UnaryContext<Integer> context = ContextBuilder.createUnaryContext();
	IStep<UnaryContext<Integer>> step = pipeline.createStep();
	IStep<UnaryContext<Integer>> step2 = pipeline.createStep();
	IChain<UnaryContext<Integer>, Boolean> c2 = pipeline.createChain(func);
	// c2.next(func);

	step2.put(c2);
	step2.put(step);
	step2.put(func);

	step2.process(context);
	System.out.println(context.context);
	}
	public static void testPipeline3(IPipeline pipeline) throws Exception {
		IConditionSelector<String, String> selector = null;
		IConditionValidator<String> validator = null;

		IProcessor<String, String> processor = null;
		IProcessor<String, String> first = null;
		IProcessor<String, String> second = null;

		IConditionSelectorProcessor<String, Boolean, String> p3 = pipeline.createProcessor(validator, first, second);
		IConditionLoopProcessor <文字列、文字列> P2 = pipeline.createProcessor(バリ、プロセッサ)。

		IConditionSelectorProcessor <文字列、文字列、文字列> P1 = pipeline.createProcessor(セレクタ)。
	}
@RunWith(SpringRunner.class)
@SpringBootTest(クラス= StepChainTestApplication.class)
パブリッククラスStepChainSpringBootTest { 
	@Autowired 
	保護IPipelineパイプライン。
	@Test 
	公共ボイドtestPipeline()例外{スロー
	PipelineTest.testPipeline(パイプライン)。
	} 
	@Test 
	公共ボイドtestPipeline2()例外{スロー
	PipelineTest.testPipeline2(パイプライン)。
	}

stepchain-UMLクラスstepchain-のjavadocstepchain-のjavadoc stepchain-のjavadoc stepchain-のjavadoc stepchain-のjavadoc

 寄付します 

おすすめ

転載: www.oschina.net/news/108867/stepchain-0-0-6-released