當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。