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


Java Subscription.request方法代码示例

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


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

示例1: testByRequest

import org.reactivestreams.Subscription; //导入方法依赖的package包/类
@Test
public void testByRequest(){
	Subscriber<Employee> subscriber = new Subscriber<Employee>(){
		
		

		@Override
		public void onComplete() {	}

		@Override
		public void onError(Throwable arg0) {	}

		@Override
		public void onNext(Employee emp) {
			System.out.println(emp);
			
		}

		@Override
		public void onSubscribe(Subscription subs) {
			subs.request(1);
		}
	};
	employeeBatchStreamServiceImpl.selectSomeEmpRecords().subscribe(subscriber);
}
 
开发者ID:PacktPublishing,项目名称:Spring-5.0-Cookbook,代码行数:26,代码来源:TestEmployeeBatchStream.java

示例2: testGetValidEmployees

import org.reactivestreams.Subscription; //导入方法依赖的package包/类
@Test
public void testGetValidEmployees(){
	Subscriber<String> mySubscription = new Subscriber<String>() {

		@Override
		public void onComplete() {	}

		@Override
		public void onError(Throwable e) {	}

		@Override
		public void onNext(String name) {
			System.out.format("Employee: %s \n", name);
		}

		@Override
		public void onSubscribe(Subscription subs) {
			subs.request(Long.MAX_VALUE);

		}

	};
	
	employeeStreamServiceImpl.getValidEmployees().subscribe(mySubscription);
}
 
开发者ID:PacktPublishing,项目名称:Spring-5.0-Cookbook,代码行数:26,代码来源:TestEmployeeStreamService.java

示例3: logSub

import org.reactivestreams.Subscription; //导入方法依赖的package包/类
private static <T> Subscriber<T> logSub() {
    return new Subscriber<T>() {

        @Override
        public void onSubscribe(Subscription subscription) {
            System.out.println("onSubscribe");
            subscription.request(Long.MAX_VALUE);

        }

        @Override
        public void onNext(T t) {
            System.out.println("on Next " + t);
        }

        @Override
        public void onError(Throwable throwable) {
            System.out.println("onError " + throwable.getMessage());
        }

        @Override
        public void onComplete() {
            System.out.println("onComplete");
        }
    };
}
 
开发者ID:sejoung,项目名称:ReactiveTest,代码行数:27,代码来源:PubSub2.java

示例4: testReadEmployees

import org.reactivestreams.Subscription; //导入方法依赖的package包/类
@Test
public void testReadEmployees(){
	
	Subscriber<Employee> mySubscription = new Subscriber<Employee>() {

		@Override
		public void onComplete() {
			System.out.println("-------------------End of Stream --------------------");
		}

		@Override
		public void onError(Throwable e) {
			System.out.println("-------------------Transmission Error --------------------");
		}

		@Override
		public void onNext(Employee emp) {
			System.out.format("%d %s %s %d \n", emp.getId(), emp.getFirstName(), emp.getLastName(), emp.getAge());
		}

		@Override
		public void onSubscribe(Subscription subs) {
			subs.request(Long.MAX_VALUE);
		}

	};
	
	employeeStreamServiceImpl.readEmployees().subscribe(mySubscription);
}
 
开发者ID:PacktPublishing,项目名称:Spring-5.0-Cookbook,代码行数:30,代码来源:TestEmployeeStreamService.java

示例5: testReadSingleEmployee

import org.reactivestreams.Subscription; //导入方法依赖的package包/类
@Test
public void testReadSingleEmployee(){
	Subscriber<Employee> mySubscription = new Subscriber<Employee>() {

		@Override
		public void onComplete() {
			System.out.println("-------------------End of Stream --------------------");
		}

		@Override
		public void onError(Throwable e) {
			System.out.println("-------------------Transmission Error --------------------");
		}

		@Override
		public void onNext(Employee emp) {
			System.out.format("%d %s %s %d \n", emp.getId(), emp.getFirstName(), emp.getLastName(), emp.getAge());

		}

		@Override
		public void onSubscribe(Subscription subs) {
			subs.request(Long.MAX_VALUE);

		}

	};
	
	employeeStreamServiceImpl.readEmployee(14).subscribe(mySubscription);
}
 
开发者ID:PacktPublishing,项目名称:Spring-5.0-Cookbook,代码行数:31,代码来源:TestEmployeeStreamService.java

示例6: onSubscribe

import org.reactivestreams.Subscription; //导入方法依赖的package包/类
@Override
public void onSubscribe(Subscription s) {
    if (SubscriptionHelper.validate(this.s, s)) {
        this.s = s;
        actual.onSubscribe(this);
        s.request(Long.MAX_VALUE);
    }
}
 
开发者ID:akarnokd,项目名称:RxJava3-preview,代码行数:9,代码来源:FlowableElementAtSingle.java

示例7: onSubscribe

import org.reactivestreams.Subscription; //导入方法依赖的package包/类
@Override public void onSubscribe(Subscription subscription) {
  this.subscription = subscription;

  subscription.request(initialRequest);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:RecordingSubscriber.java

示例8: onSubscribe

import org.reactivestreams.Subscription; //导入方法依赖的package包/类
@Override
public void onSubscribe(Subscription s) {
    this.subscription = s;
    s.request(1);
}
 
开发者ID:cschneider,项目名称:reactive-components,代码行数:6,代码来源:KafkaDestination.java

示例9: onSubscribe

import org.reactivestreams.Subscription; //导入方法依赖的package包/类
@Override
public void onSubscribe(Subscription s) {
    s.request(Long.MAX_VALUE);
}
 
开发者ID:akarnokd,项目名称:RxJava3-preview,代码行数:5,代码来源:FlowableFromSourceTest.java

示例10: onSubscribe

import org.reactivestreams.Subscription; //导入方法依赖的package包/类
@Override
public void onSubscribe(Subscription s) {
    if (SubscriptionHelper.setOnce(this.s, s)) {
        s.request(Long.MAX_VALUE);
    }
}
 
开发者ID:akarnokd,项目名称:RxJava3-preview,代码行数:7,代码来源:FutureSubscriber.java

示例11: onSubscribe

import org.reactivestreams.Subscription; //导入方法依赖的package包/类
@Override
public void onSubscribe(Subscription s) {
    if (SubscriptionHelper.setOnce(this, s)) {
        s.request(batchSize);
    }
}
 
开发者ID:akarnokd,项目名称:RxJava3-preview,代码行数:7,代码来源:BlockingFlowableIterable.java

示例12: accept

import org.reactivestreams.Subscription; //导入方法依赖的package包/类
@Override
public void accept(Subscription t) throws Exception {
    t.request(Long.MAX_VALUE);
}
 
开发者ID:akarnokd,项目名称:RxJava3-preview,代码行数:5,代码来源:MaxRequestSubscription.java


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