CCMQ is a message queue framework built for iOS

Related tags

GCD CCMQ
Overview

CCMQ

CCMQ是基于MMAP开发的适用于iOS的消息队列框架

基本特性介绍

1.到达性和顺序性:

CCMQ会确保消息一定能够发送到订阅者,CCMQ拥有串行和并行队列,串行队列会确保消息能够按照顺序发送顺序到达订阅者,并行队列则能够批量进行消息发送,但同一批次的消息到达顺序不能保证。

2.ACK机制:

1.自动ACK:

CCMQ支持自动ACK,当消息到达所有订阅者之后,该条消息会自动回复ACK,代表该消息完成发送,将会从队列中移除并销毁

2.手动ACK:

CCMQ支持手动ACK,订阅者可以根据自己的需要手动进行ACK回复

3.重发机制

CCMQ提供了自动重发机制,当订阅者超时没有ACK时,CCMQ会进行消息重发

4.消息持久化

CCMQ的会对消息进行持久化,意味着消息队列内的消息不会因为APP被杀掉而丢失,在APP再次打开之后,消息队列会恢复消息的发送

使用教程

1.环境要求:

CCMQ支持 iOS 6 以上

2.安装:

pod 'CCMQ'

3.初始化队列:

//串行队列
CCMQMessageQueue *searialQueue = [[CCMQMessageQueue alloc] initWithType:CCMQMessageQueueTypeSerial tag:@"serial"]

//并行队列
CCMQMessageQueue *concurrentQueue = [[CCMQMessageQueue alloc] initWithType:CCMQMessageQueueTypeConcurrent tag:@"concurrent"];
//设置并行发送的消息数量
concurrentQueue.maxConcurrentCount = 5;

4.发送消息:

通过调用以下的方法,CCMQ会向订阅者发送消息

CCMQMessage *message = [[CCMQMessage alloc] init];
//设置消息内容
message.message = "Datas";
[queue publish:message];

5.订阅消息队列:

每一个订阅者都需要设置port,port代表该订阅者的身份标识,当APP重新启动时,CCMQ通过port来判断该向哪些订阅者恢复消息发送。

注意:当所有的port都ACK以后,才代表该消息发送完毕

CCMQMessageSubscriber *subSerial = [[CCMQMessageSubscriber alloc] init];
//设置订阅者的port号
subSerial.port = @"sub1";
subSerial.subscribe = ^(CCMQMessage * _Nonnull message) {
    //订阅者可以在这里处理收到的消息
    ...
    //对于手动ACK的队列,需要手动进行ACK回复
    [queue finishMessage:message port:@"sub1"];
};
[queue addSubscriber:subSerial];
You might also like...
A Task Queue Class developed in Swift (by Marin Todorov)
A Task Queue Class developed in Swift (by Marin Todorov)

TaskQueue Table of Contents Intro Installation CocoaPods Carthage Simple Examples Synchronous tasks Asynchronous tasks Serial and Concurrent Tasks GCD

SwiftRingBuffer - RingBuffer aka Circular Queue
SwiftRingBuffer - RingBuffer aka Circular Queue

Swift Ring Buffer Ring Buffer aka Circular Queue Ussage var queue = CircularQueu

Lightweight & Simple Framework For Creating Message App

Lightweight & Simple Framework For Creating Message App

Aftermath is a stateless message-driven micro-framework in Swift
Aftermath is a stateless message-driven micro-framework in Swift

Aftermath is a stateless message-driven micro-framework in Swift, which is based on the concept of the unidirectional data flow architecture.

A message bar for iOS written in Swift.
A message bar for iOS written in Swift.

Dodo, a message bar for iOS / Swift This is a UI widget for showing text messages in iOS apps. It is useful for showing short messages to the user, so

A very flexible message bar for iOS written in Swift.
A very flexible message bar for iOS written in Swift.

A very flexible message bar for iOS written in Swift.

A message bar for iOS written in Swift.
A message bar for iOS written in Swift.

Dodo, a message bar for iOS / Swift This is a UI widget for showing text messages in iOS apps. It is useful for showing short messages to the user, so

A message bar for iOS written in Swift.
A message bar for iOS written in Swift.

Dodo, a message bar for iOS / Swift This is a UI widget for showing text messages in iOS apps. It is useful for showing short messages to the user, so

Message passing between iOS apps and extensions.
Message passing between iOS apps and extensions.

MMWormhole MMWormhole creates a bridge between an iOS or OS X extension and its containing application. The wormhole is meant to be used to pass data

CipherCode - iOS App to decode your secret message
CipherCode - iOS App to decode your secret message

CipherCode IOS App to decode/encode your secret message App App consist of welco

Native alert from Apple Music & Feedback. Contains Done, Heart & Message and other presets.
Native alert from Apple Music & Feedback. Contains Done, Heart & Message and other presets.

SPAlert Popup from Apple Music & Feedback in AppStore. Contains Done, Heart, Error and other presets. Supports Dark Mode. I tried to recreate Apple's

Lightweight dropdown message bar in Swift. It's simple and beautiful.
Lightweight dropdown message bar in Swift. It's simple and beautiful.

SwiftyDrop SwiftyDrop is a lightweight pure Swift simple and beautiful dropdown message. Features Easy to use like: Drop.down("Message") Message field

SSToastMessage is written purely in SwiftUI. It will add toast, alert, and floating message view over the top of any view. It is intended to be simple, lightweight, and easy to use. It will be a popup with a single line of code.
SSToastMessage is written purely in SwiftUI. It will add toast, alert, and floating message view over the top of any view. It is intended to be simple, lightweight, and easy to use. It will be a popup with a single line of code.

SSToastMessage SSToastMessage is written in SwiftUI. It will add toast, alert, and floating message view over the top of any view. It is intended to b

TTGSnackbar shows simple message and action button on the bottom or top of the screen with multi kinds of animation, which is written in Swift3 and inspired by Snackbar in Android. It also support showing custom view, icon image or multi action button.
Generate protobuf message definitions from Swift structs

SwiftProtobufGen Generates protobuf definitions from Swift structs Building For some reason Xcode builds don't work at all but swiftpm command line bu

SocialLib handles sharing message to multiple social media.

SocialLib ###What is SocialLib? SocialLib is a library that aims to share information to different social media site without getting your code messy w

A simple solution to show a toast message by writing single one line of code
A simple solution to show a toast message by writing single one line of code

easySwiftToast A very simple solution to show a toast message by writing single one line of code. Installation easySwiftToast is available through Coc

Native alert from Apple Music & Feedback. Contains Done, Heart & Message and other presets. Support SwiftUI.
Native alert from Apple Music & Feedback. Contains Done, Heart & Message and other presets. Support SwiftUI.

SPAlert Popup from Apple Music & Feedback in AppStore. Contains Done, Heart, Error and other presets. Supports Dark Mode. I tried to recreate Apple's

Releases(1.0.1)
Owner
null
SwiftRingBuffer - RingBuffer aka Circular Queue

Swift Ring Buffer Ring Buffer aka Circular Queue Ussage var queue = CircularQueu

null 1 Feb 1, 2022
Queuer is a queue manager, built on top of OperationQueue and Dispatch (aka GCD).

Queuer is a queue manager, built on top of OperationQueue and Dispatch (aka GCD). It allows you to create any asynchronous and synchronous task easily, all managed by a queue, with just a few lines.

Fabrizio Brancati 1k Dec 2, 2022
A crisp in-app notification/message banner built in Swift.

RMessage Screenshots Intro Welcome to RMessage! RMessage is a simple notification library written in Swift to help you display notification on the scr

Adonis Peralta 407 Nov 29, 2022
iOS utility class to manage global dispatch queue.

YYDispatchQueuePool iOS utility class to manage global dispatch queue. (It's a component of YYKit) When use a concurrent queue to execute lots of bloc

null 464 Oct 31, 2022
A real-time, votable, democratized music queue on iPad and iPhone using Spotify

Queue'd Music Queue'd is the best way to enjoy music with your friends. Add your favorite songs to a shared music queue at your favorite bars, restaur

Ryan Daulton 88 Dec 2, 2022
ClassicPhotos is a TableView App demos how to optimize image download and filter with operation queue.

ClassicPhotos ClassicPhotos is a TableView App demos how to optimize image download and filter with operation queue. With Operation and Operation Queu

Kushal Shingote 2 Dec 18, 2021
A protocol-centric, type and queue safe key-value workflow.

Light-weight, strict protocol-first styled PropertyKit helps you to easily and safely handle guaranteed values, keys or types on various situations of

gitmerge 12 Feb 26, 2021
A Generic Priority Queue in Pure Swift

SwiftPriorityQueue SwiftPriorityQueue is a pure Swift (no Cocoa) implementation of a generic priority queue data structure, appropriate for use on all

David Kopec 350 Dec 22, 2022
Queue management system for AVSpeechSynthesizer

QHSpeechSynthesizerQueue Queue management system for AVSpeechSynthesizer Installation Cocoapods Add this to your Podfile: pod 'QHSpeechSynthesizerQueu

Quentin Hayot 42 Dec 17, 2021
Dead-simple queue-oriented client for Spotify

Spotiqueue A terribly simple macOS app for keyboard-based, queue-oriented Spotify use. Many years ago i built a version which relied on a now-deprecat

paul 74 Dec 3, 2022