本文整理汇总了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);
}
示例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);
}
示例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");
}
};
}
示例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);
}
示例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);
}
示例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);
}
}
示例7: onSubscribe
import org.reactivestreams.Subscription; //导入方法依赖的package包/类
@Override public void onSubscribe(Subscription subscription) {
this.subscription = subscription;
subscription.request(initialRequest);
}
示例8: onSubscribe
import org.reactivestreams.Subscription; //导入方法依赖的package包/类
@Override
public void onSubscribe(Subscription s) {
this.subscription = s;
s.request(1);
}
示例9: onSubscribe
import org.reactivestreams.Subscription; //导入方法依赖的package包/类
@Override
public void onSubscribe(Subscription s) {
s.request(Long.MAX_VALUE);
}
示例10: onSubscribe
import org.reactivestreams.Subscription; //导入方法依赖的package包/类
@Override
public void onSubscribe(Subscription s) {
if (SubscriptionHelper.setOnce(this.s, s)) {
s.request(Long.MAX_VALUE);
}
}
示例11: onSubscribe
import org.reactivestreams.Subscription; //导入方法依赖的package包/类
@Override
public void onSubscribe(Subscription s) {
if (SubscriptionHelper.setOnce(this, s)) {
s.request(batchSize);
}
}
示例12: accept
import org.reactivestreams.Subscription; //导入方法依赖的package包/类
@Override
public void accept(Subscription t) throws Exception {
t.request(Long.MAX_VALUE);
}