@@ -47,6 +47,14 @@ enum OptionType implements Option.OptionType {
4747 <T > T get (Map <Option .OptionType , ?> options ) {
4848 return (T ) options .get (this );
4949 }
50+
51+ String getString (Map <Option .OptionType , ?> options ) {
52+ return get (options );
53+ }
54+
55+ Integer getInteger (Map <Option .OptionType , ?> options ) {
56+ return get (options );
57+ }
5058 }
5159
5260 private ListOption (OptionType option , Object value ) {
@@ -73,27 +81,31 @@ public static ListOption pageToken(String pageToken) {
7381 */
7482 final class PullOption extends Option {
7583
76- private static final long serialVersionUID = - 5220474819637439937L ;
84+ private static final long serialVersionUID = 4792164134340316582L ;
7785
7886 enum OptionType implements Option .OptionType {
79- MAX_MESSAGES ;
87+ MAX_CONCURRENT_CALLBACKS ;
8088
8189 @ SuppressWarnings ("unchecked" )
8290 <T > T get (Map <Option .OptionType , ?> options ) {
8391 return (T ) options .get (this );
8492 }
93+
94+ Integer getInteger (Map <Option .OptionType , ?> options ) {
95+ return get (options );
96+ }
8597 }
8698
87- private PullOption (OptionType option , Object value ) {
99+ private PullOption (Option . OptionType option , Object value ) {
88100 super (option , value );
89101 }
90102
91103 /**
92- * Returns an option to specify the maximum number of messages that can be returned by the pull
93- * operation .
104+ * Returns an option to specify the maximum number of messages that can be executed
105+ * concurrently at any time .
94106 */
95- public static PullOption maxMessages (int maxMessages ) {
96- return new PullOption (OptionType .MAX_MESSAGES , maxMessages );
107+ public static PullOption maxConcurrentCallbacks (int maxConcurrency ) {
108+ return new PullOption (OptionType .MAX_CONCURRENT_CALLBACKS , maxConcurrency );
97109 }
98110 }
99111
@@ -110,38 +122,6 @@ interface MessageProcessor {
110122 */
111123 interface MessageConsumer extends AutoCloseable {
112124
113- /**
114- * Class for specifying options to pull messages through a {@code MessageConsumer}.
115- */
116- final class PullOption extends Option {
117-
118- private static final long serialVersionUID = 4792164134340316582L ;
119-
120- enum OptionType implements Option .OptionType {
121- MAX_CONCURRENT_CALLBACKS ;
122-
123- @ SuppressWarnings ("unchecked" )
124- <T > T get (Map <OptionType , ?> options ) {
125- return (T ) options .get (this );
126- }
127- }
128-
129- private PullOption (OptionType option , Object value ) {
130- super (option , value );
131- }
132-
133- /**
134- * Returns an option to specify the maximum number of messages that can be executed
135- * concurrently at any time.
136- */
137- public static PullOption maxConcurrentCallbacks (int maxConcurrency ) {
138- return new PullOption (OptionType .MAX_CONCURRENT_CALLBACKS , maxConcurrency );
139- }
140- }
141-
142- void start (MessageConsumer .PullOption ... options );
143-
144- void stop ();
145125 }
146126
147127 Topic create (TopicInfo topic );
@@ -200,11 +180,11 @@ public static PullOption maxConcurrentCallbacks(int maxConcurrency) {
200180
201181 Future <AsyncPage <SubscriptionId >> listSubscriptionsAsync (String topic , ListOption ... options );
202182
203- Iterator <ReceivedMessage > pull (String subscription , PullOption ... options );
183+ Iterator <ReceivedMessage > pull (String subscription , int maxMessages );
204184
205- Future <Iterator <ReceivedMessage >> pullAsync (String subscription , PullOption ... options );
185+ Future <Iterator <ReceivedMessage >> pullAsync (String subscription , int maxMessages );
206186
207- MessageConsumer pullAsync (String subscription , MessageProcessor callback );
187+ MessageConsumer pullAsync (String subscription , MessageProcessor callback , PullOption ... options );
208188
209189 void ack (String subscription , String ackId , String ... ackIds );
210190
0 commit comments