当前位置: 首页>>代码示例>>Java>>正文


Java Flux.just方法代码示例

本文整理汇总了Java中reactor.core.publisher.Flux.just方法的典型用法代码示例。如果您正苦于以下问题:Java Flux.just方法的具体用法?Java Flux.just怎么用?Java Flux.just使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在reactor.core.publisher.Flux的用法示例。


在下文中一共展示了Flux.just方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDeepCrawling

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
@Test
public void getDeepCrawling() throws Exception {

    String url = "http://localhost:8089/example";

    WebsiteModel seedWebsite = new WebsiteModel();
    seedWebsite.setUrl(url);

    Flux<WebsiteModel> flux = Flux.just(seedWebsite);

    given(crawlerBatchService.getWebsites(
            seedWebsite,
            null,
            new URI(url),
            0
    )).willReturn(flux);

    given(this.amazonDynamoDBAsync.putItemAsync(this.putItemRequest(url, EStatus.PROCESSING)))
            .willReturn(this.putItemResult(url, EStatus.PROCESSING));

    given(this.amazonDynamoDBAsync.putItemAsync(this.putItemRequest(url, EStatus.COMPLETED)))
            .willReturn(this.putItemResult(url, EStatus.COMPLETED));

    crawlerBatchTask.getDeepCrawling(url);

}
 
开发者ID:hafidsousa,项目名称:webcrawler,代码行数:27,代码来源:CrawlerBatchTaskTest.java

示例2: getAllBooks

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
@GetMapping("/books")
public Flux<List<Book>> getAllBooks() {

	ArrayList<Book> books=new ArrayList<Book>();
	books.add(new Book("Spring 5.0",1234l,"Packt Pub Publication",500,"Learn Spring", "T.M.Jog"));
	books.add(new Book("Learn Modular Java",1234l,"Packt Pub Publication",500,"Learn java", "Author1"));
	return Flux.just(books);
}
 
开发者ID:PacktPublishing,项目名称:Learning-Spring-5.0,代码行数:9,代码来源:MyBookController.java

示例3: createFailedPublisher

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
@Override
public Publisher<Message> createFailedPublisher() {
    ReactorTckGrpc.ReactorTckStub stub = ReactorTckGrpc.newReactorStub(channel);
    Flux<Message> request = Flux.just(toMessage(TckService.KABOOM));
    Mono<Message> publisher = stub.manyToOne(request);

    return publisher.flux();
}
 
开发者ID:salesforce,项目名称:reactive-grpc,代码行数:9,代码来源:ReactorGrpcPublisherManyToOneVerificationTest.java

示例4: images

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
@GetMapping(API_BASE_PATH + "/images")
Flux<Image> images() {
	return Flux.just(
		new Image("1", "learning-spring-boot-cover.jpg"),
		new Image("2", "learning-spring-boot-2nd-edition-cover.jpg"),
		new Image("3", "bazinga.png")
	);
}
 
开发者ID:PacktPublishing,项目名称:Learning-Spring-Boot-2.0-Second-Edition,代码行数:9,代码来源:ApiController.java

示例5: getWebsites

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
@Override
public Flux<WebsiteModel> getWebsites(
        WebsiteModel seedWebsite,
        WebsiteModel parentWebsite,
        URI currentUrl,
        Integer depth
) {

    if (depth == 0) urls = new ConcurrentHashMap<>();

    if (depth > MAX_DEPTH) return Flux.just(seedWebsite);

    return Flux.merge(
            Flux.empty(),
            Flux.from(this.getBody(currentUrl))
                    .flatMap((body) -> getWebsiteModel(seedWebsite, parentWebsite, currentUrl.toString(), body, depth))
                    .flatMap((website) -> getParsedUrl(website, seedWebsite.getUrl(), depth))
                    .flatMap((website) -> {
                        LOG.info(Utils.success.log_recursion, depth, seedWebsite.getUrl(), website.getUrl());
                        try
                        {
                            urls.put(website.getUrl(), website);
                            return getWebsites(seedWebsite, website.getParent(), new URI(website.getUrl()), depth + 1);

                        }
                        catch (URISyntaxException e)
                        {
                            LOG.error(e.getMessage());
                            return Flux.empty();
                        }
                    })
    );
}
 
开发者ID:hafidsousa,项目名称:webcrawler,代码行数:34,代码来源:CrawlerBatchService.java

示例6: initData

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
@Bean
CommandLineRunner initData(ReactiveUserRepository personRepository) {
  Flux<Person> people = Flux.just(
      new Person("1", "Eric", "Foo", "Zh"),
      new Person("2", "Raymond", "Bar", "B"),
      new Person("3", "Paul", "Baz", "x")
  );

  return args -> {
    personRepository.deleteAll().thenMany(personRepository.saveAll(people)).blockLast();
  };

}
 
开发者ID:amoAHCP,项目名称:openshift-workshop,代码行数:14,代码来源:FrontendApplication.java

示例7: initData

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
@Bean
CommandLineRunner initData(ReactiveUserRepository personRepository) {
  Flux<Person> people = Flux.just(
      new Person("1", "Eric", "Foo","Zh"),
      new Person("2", "Raymond", "Bar","B"),
      new Person("3", "Paul", "Baz","x")
  );

  return args -> {
    personRepository.deleteAll().thenMany(personRepository.saveAll(people)).blockLast();
  };

}
 
开发者ID:amoAHCP,项目名称:openshift-workshop,代码行数:14,代码来源:FrontendApplication.java

示例8: manyToOne

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
@Test
public void manyToOne() {
    ReactorGreeterGrpc.ReactorGreeterStub stub = ReactorGreeterGrpc.newReactorStub(channel);
    Flux<HelloRequest> req = Flux.just(HelloRequest.getDefaultInstance());
    Mono<HelloResponse> resp = stub.sayHelloReqStream(req);

    StepVerifier.create(resp)
            .verifyErrorMatches(t -> t instanceof StatusRuntimeException && ((StatusRuntimeException)t).getStatus().getCode() == Status.Code.CANCELLED);
}
 
开发者ID:salesforce,项目名称:reactive-grpc,代码行数:10,代码来源:UnexpectedServerErrorIntegrationTest.java

示例9: allMessages

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
@GetMapping
Flux<Message> allMessages(){
    return Flux.just(
        Message.builder().body("hello Spring 5").build(),
        Message.builder().body("hello Spring Boot 2").build()
    );
}
 
开发者ID:hantsy,项目名称:spring-reactive-sample,代码行数:8,代码来源:DemoApplication.java

示例10: manyToOne

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
@Test
public void manyToOne() {
    ReactorGreeterGrpc.ReactorGreeterStub stub = ReactorGreeterGrpc.newReactorStub(channel);
    Flux<String> reactorRequest = Flux.just("A", "B", "C");
    Mono<String> reactorResponse = stub.sayHelloReqStream(reactorRequest.map(this::toRequest)).map(this::fromResponse);

    StepVerifier.create(reactorResponse)
            .expectNext("Hello A and B and C")
            .verifyComplete();
}
 
开发者ID:salesforce,项目名称:reactive-grpc,代码行数:11,代码来源:ReactiveClientStandardServerInteropTest.java

示例11: starters

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
@RequestMapping(value = "/starters")
public Flux<BootStarter> starters() {
	return Flux.just(new BootStarter("spring-boot-starter-web-reactive", "Spring Boot Web Reactive"),
			new BootStarter("spring-boot-starter-web", "Spring Boot Web"),
			new BootStarter("spring-boot-starter-websocket", "Spring Boot Websocket"));
}
 
开发者ID:callistaenterprise,项目名称:spring-react-one,代码行数:7,代码来源:HomeController.java

示例12: extract

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
private Flux<?> extract(Object input) {
	if (input instanceof Collection) {
		return Flux.fromIterable((Iterable<?>) input);
	}
	return Flux.just(input);
}
 
开发者ID:kbastani,项目名称:service-block-samples,代码行数:7,代码来源:SpringBootRequestHandler.java

示例13: fluxShouldMapValueToUpperCaseHelloWorld

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
@Test
public void fluxShouldMapValueToUpperCaseHelloWorld() {

	Flux<String> flux = Flux.just("Mike", "Gustavo");

	flux = flux.map(String::toUpperCase);

	StepVerifier.create(flux).expectNext("MIKE", "GUSTAVO").verifyComplete();
}
 
开发者ID:mp911de,项目名称:reactive-spring,代码行数:10,代码来源:Step4Transformations.java

示例14: adoptFluxToRxJava2Flowable

import reactor.core.publisher.Flux; //导入方法依赖的package包/类
@Test
public void adoptFluxToRxJava2Flowable() throws Exception {

	Flux<String> people = Flux.just("Jesse", "Hank");

	Flowable<String> flowable = Flowable.fromPublisher(people);

	flowable.test().await().assertResult("Jesse", "Hank").awaitTerminalEvent();
}
 
开发者ID:mp911de,项目名称:reactive-spring,代码行数:10,代码来源:Step6Adapters.java


注:本文中的reactor.core.publisher.Flux.just方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。