RKRequestQueue Class Reference
Inherits from | NSObject |
Declared in | RKRequestQueue.h RKRequestQueue.m |
Overview
A lightweight queue implementation responsible for dispatching and managing RKRequest objects.
Tasks
Creating a Request Queue
-
+ requestQueue
Creates and returns a new request queue.
-
+ newRequestQueueWithName:
Returns a new retained request queue with the given name. If there is already an existing queue with the given name, nil will be returned.
Retrieving an Existing Queue
-
+ requestQueueWithName:
Returns queue with the specified name. If no queue is found with the name provided, a new queue will be initialized and returned.
Naming Queues
-
name
A symbolic name for the queue.
property -
+ requestQueueExistsWithName:
Determine if a queue exists with a given name.
Monitoring State Changes
-
delegate
The delegate to inform when the request queue state machine changes.
property
Managing the Queue
-
concurrentRequestsLimit
The number of concurrent requests supported by this queue.
property -
requestTimeout
Request timeout value used by the queue.
property -
count
Returns the total number of requests in the queue.
property -
– addRequest:
Add an asynchronous request to the queue and send it as as soon as possible.
-
– cancelRequest:
Cancel a request that is in progress.
-
– cancelRequestsWithDelegate:
Cancel all requests with a given delegate.
-
– abortRequestsWithDelegate:
Aborts all requests with a given delegate by nullifying the delegate reference and canceling the request.
-
– cancelAllRequests
Cancel all active or pending requests.
-
– containsRequest:
Determine if a given request is currently in this queue.
Processing Queued Requests
-
– start
Start checking for and processing requests.
-
suspended
Sets the flag that determines if new load requests are allowed to reach the network.
property -
loadingCount
Returns the total number of requests that are currently loading.
property -
showsNetworkActivityIndicatorWhenBusy
Sets the flag for showing the network activity indicatory.
property
Global Queues (Deprecated)
-
+ sharedQueue
Returns the global queue
-
+ setSharedQueue:
Sets the global queue
Properties
concurrentRequestsLimit
The number of concurrent requests supported by this queue.
@property (nonatomic) NSUInteger concurrentRequestsLimit
Discussion
Default: 5 concurrent requests
Declared In
RKRequestQueue.h
count
Returns the total number of requests in the queue.
@property (nonatomic, readonly) NSUInteger count
Declared In
RKRequestQueue.h
delegate
The delegate to inform when the request queue state machine changes.
@property (nonatomic, assign) id<> delegate
Discussion
If the object implements the RKRequestQueueDelegate protocol, it will receive request lifecycle event messages.
Declared In
RKRequestQueue.h
loadingCount
Returns the total number of requests that are currently loading.
@property (nonatomic, readonly) NSUInteger loadingCount
Declared In
RKRequestQueue.h
name
A symbolic name for the queue.
@property (nonatomic, retain, readonly) NSString *name
Discussion
Used to return existing queue references via [RKRequestQueue requestQueueWithName:]
Declared In
RKRequestQueue.h
requestTimeout
Request timeout value used by the queue.
@property (nonatomic, assign) NSUInteger requestTimeout
Discussion
Default: 5 minutes (300 seconds)
Declared In
RKRequestQueue.h
showsNetworkActivityIndicatorWhenBusy
Sets the flag for showing the network activity indicatory.
@property (nonatomic) BOOL showsNetworkActivityIndicatorWhenBusy
Discussion
When YES, this queue will spin the network activity in the menu bar when it is processing requests.
Default: NO
Declared In
RKRequestQueue.h
suspended
Sets the flag that determines if new load requests are allowed to reach the network.
@property (nonatomic) BOOL suspended
Discussion
Because network requests tend to slow down performance, this property can be used to temporarily delay them. All requests made while suspended are queued, and when suspended becomes false again they are executed.
Declared In
RKRequestQueue.h
Class Methods
newRequestQueueWithName:
Returns a new retained request queue with the given name. If there is already an existing queue with the given name, nil will be returned.
+ (id)newRequestQueueWithName:(NSString *)name
Parameters
- name
A symbolic name for the queue.
Return Value
A new retained RKRequestQueue with the given name or nil if one already exists with the given name.
Declared In
RKRequestQueue.h
requestQueue
Creates and returns a new request queue.
+ (id)requestQueue
Return Value
An autoreleased RKRequestQueue object.
Declared In
RKRequestQueue.h
requestQueueExistsWithName:
Determine if a queue exists with a given name.
+ (BOOL)requestQueueExistsWithName:(NSString *)name
Parameters
- name
The queue name to search against.
Return Value
YES when there is a queue with the given name.
Declared In
RKRequestQueue.h
requestQueueWithName:
Returns queue with the specified name. If no queue is found with the name provided, a new queue will be initialized and returned.
+ (id)requestQueueWithName:(NSString *)name
Parameters
- name
A symbolic name for the queue.
Return Value
An existing RKRequestQueue with the given name or a new queue if none currently exist.
Declared In
RKRequestQueue.h
setSharedQueue:
Sets the global queue
+ (void)setSharedQueue:(RKRequestQueue *)requestQueue
Parameters
- requestQueue
The request queue to assign as the global queue.
Discussion
Bug: DEPRECATED in v0.9.4: All RKClient instances now own their own individual request queues.
See Also
Declared In
RKRequestQueue.h
sharedQueue
Returns the global queue
+ (RKRequestQueue *)sharedQueue
Return Value
Global request queue.
Discussion
Bug: DEPRECATED in v0.9.4: All RKClient instances now own their own individual request queues.
See Also
Declared In
RKRequestQueue.h
Instance Methods
abortRequestsWithDelegate:
Aborts all requests with a given delegate by nullifying the delegate reference and canceling the request.
- (void)abortRequestsWithDelegate:(id<RKRequestDelegate>)delegate
Parameters
- delegate
The object acting as the delegate for all enqueued requests that are to be aborted.
Discussion
Useful when an object that acts as the delegate for one or more requests is being deallocated and all outstanding requests should be canceled without generating any further delegate callbacks.
Declared In
RKRequestQueue.h
addRequest:
Add an asynchronous request to the queue and send it as as soon as possible.
- (void)addRequest:(RKRequest *)request
Parameters
- request
The request to be added to the queue.
Declared In
RKRequestQueue.h
cancelAllRequests
Cancel all active or pending requests.
- (void)cancelAllRequests
Declared In
RKRequestQueue.h
cancelRequest:
Cancel a request that is in progress.
- (void)cancelRequest:(RKRequest *)request
Parameters
- request
The request to be cancelled.
Declared In
RKRequestQueue.h
cancelRequestsWithDelegate:
Cancel all requests with a given delegate.
- (void)cancelRequestsWithDelegate:(id<RKRequestDelegate>)delegate
Parameters
- delegate
The delegate assigned to the requests to be cancelled.
Declared In
RKRequestQueue.h