Skip to content

Commit 9dbf9ad

Browse files
committed
Objc tutorial2 update
persistent:YES, don't show separate manual ack method. [#116890463]
1 parent e4cac6b commit 9dbf9ad

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
github "robbiehanson/CocoaAsyncSocket" "562bae6af6dbd7e1891293dae20b9f79a2fd7228"
22
github "Mantle/Mantle" "a16d18f635b3ba1ffb01d27d4393ee97cadf4f34"
3-
git "/Users/pivotal/workspace/rabbitmq-objc-client" "7c75c54a1f36265e3c089a7e8cbc1c1876ab06ea"
3+
git "/Users/pivotal/workspace/rabbitmq-objc-client" "ea25de2d8d43152f8040d0994a9a3a4239d9442f"

objective-c/tutorial2/tutorial2/ViewController.m

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ - (void)newTask:(NSString *)msg {
2626

2727
RMQQueue *q = [ch queue:@"task_queue" options:RMQQueueDeclareDurable];
2828

29-
[ch.defaultExchange publish:msg routingKey:q.name];
29+
[ch.defaultExchange publish:msg routingKey:q.name persistent:YES];
3030
NSLog(@"Sent %@", msg);
3131

3232
[conn close];
@@ -43,26 +43,6 @@ - (void)workerNamed:(NSString *)name {
4343
[ch basicQos:@1 global:NO];
4444
NSLog(@"%@: Waiting for messages", name);
4545

46-
[q subscribe:^(id<RMQMessage> _Nonnull message) {
47-
NSLog(@"%@: Received %@", name, message.content);
48-
// imitate some work
49-
unsigned int sleepTime = (unsigned int)[message.content componentsSeparatedByString:@"."].count - 1;
50-
NSLog(@"%@: Sleeping for %u seconds", name, sleepTime);
51-
sleep(sleepTime);
52-
}];
53-
}
54-
55-
- (void)workerWithManualAckNamed:(NSString *)name {
56-
RMQConnection *conn = [[RMQConnection alloc] initWithDelegate:[RMQConnectionDelegateLogger new]];
57-
[conn start];
58-
59-
id<RMQChannel> ch = [conn createChannel];
60-
61-
RMQQueue *q = [ch queue:@"task_queue" options:RMQQueueDeclareDurable];
62-
63-
[ch basicQos:@1 global:NO];
64-
NSLog(@"%@: Waiting for messages", name);
65-
6646
RMQBasicConsumeOptions manualAck = RMQBasicConsumeNoOptions;
6747
[q subscribe:manualAck handler:^(id<RMQMessage> _Nonnull message) {
6848
NSLog(@"%@: Received %@", name, message.content);

0 commit comments

Comments
 (0)