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