This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
AsyncSocket.h | Wed Jul 22 19:22:33 -0700 2009 | |
| |
AsyncSocket.m | Wed Jul 22 19:22:33 -0700 2009 | |
| |
CRVStompClient.h | Wed Oct 21 00:42:25 -0700 2009 | |
| |
CRVStompClient.m | Wed Oct 21 00:42:25 -0700 2009 | |
| |
LICENSE | Tue Oct 06 00:47:52 -0700 2009 | |
| |
README.md | Tue Oct 06 01:56:21 -0700 2009 | |
| |
Rakefile | Mon Oct 05 19:54:44 -0700 2009 |
README.md
STOMP client for Objective-C
This is a simple STOMP client based on
- an initial implementation (StompService) from Scott Raymond sco@scottraymond.net (see http://gist.github.com/72935)
- and AsynSocket: http://code.google.com/p/cocoaasyncsocket/
Documentation
http://dev.coravy.com/wiki/display/OpenSource/Stomp+client+for+Objective-C
Usage
Add AsynSocket.{h,m} and CRVStompClient.{h,m} to your project.
MyExample.h
#import <Foundation/Foundation.h>
@class CRVStompClient;
@protocol CRVStompClientDelegate;
@interface MyExample : NSObject<CRVStompClientDelegate> {
@private
CRVStompClient *service;
}
@property(nonatomic, retain) CRVStompClient *service;
@end
In MyExample.m
#define kUsername @"USERNAME"
#define kPassword @"PASS"
#define kQueueName @"/topic/systemMessagesTopic"
[...]
-(void) aMethod {
CRVStompClient *s = [[CRVStompClient alloc]
initWithHost:@"localhost"
port:61613
login:kUsername
passcode:kQueueName
delegate:self];
[s connect];
NSDictionary *headers = [NSDictionary dictionaryWithObjectsAndKeys:
@"client", @"ack",
@"true", @"activemq.dispatchAsync",
@"1", @"activemq.prefetchSize", nil];
[s subscribeToDestination:kQueueName withHeader: headers];
[self setService: s];
[s release];
}
#pragma mark CRVStompClientDelegate
- (void)stompClientDidConnect:(CRVStompClient *)stompService {
NSLog(@"stompServiceDidConnect");
}
- (void)stompClient:(CRVStompClient *)stompService messageReceived:(NSString *)body withHeader:(NSDictionary *)messageHeader {
NSLog(@"gotMessage body: %@, header: %@", body, messageHeader);
NSLog(@"Message ID: %@", [messageHeader valueForKey:@"message-id"]);
// If we have successfully received the message ackknowledge it.
[stompService ack: [messageHeader valueForKey:@"message-id"]];
}
- (void)dealloc {
[service unsubscribeFromDestination: kQueueName];
[service release];
[super dealloc];
}







