首页 \ 问答 \ RabbitMQ集群用例没有HA(RabbitMQ clustering use case w/o HA)

RabbitMQ集群用例没有HA(RabbitMQ clustering use case w/o HA)

这是关于RabbitMQ集群的用例问题。 在过去,我已经将RabbitMQ聚集在一起,以使队列高度可用(HA)。 我知道你可以在没有HA队列的情况下集群RabbitMQ节点,但为什么要这样做呢? 从消息的消费者POV来看,除非队列是HA(或者我觉得),否则群集本身不会给你带来任何好处。 您可以引用什么样的用例来构建非HA RabbitMQ集群?


this is a use case question on RabbitMQ clustering. In the past, I have clustered RabbitMQ to make queues highly available (HA). I understand you can cluster RabbitMQ nodes without making HA queues but why would you do that? From a message consumer's POV, clustering in itself buys you nothing unless the queues are made HA (or so I feel). What kind of use-cases can you cite for make a non-HA RabbitMQ cluster?


原文:https://stackoverflow.com/questions/26468872
更新时间:2022-08-12 12:08

最满意答案

使用单例类,我总是将它们用于需要从应用程序内部的任何位置访问的全局数据管理器类。 您可以创建一个这样的简单:

@interface NewsArchiveManager : NetworkDataManager
{
}

+ (NewsArchiveManager *) sharedInstance;
@end

@implementation NewsArchiveManager

- (id) init
{
    self = [super init];
    if ( self ) 
    {
         // custom initialization goes here
    }

    return self;
}


+ (NewsArchiveManager *) sharedInstance
{
    static NewsArchiveManager *g_instance = nil;

    if ( g_instance == nil )
    {
        g_instance = [[self alloc] init];
    }

    return g_instance;
}


- (void) dealloc
{
    [super dealloc];
}

@end

Use a singleton class, I use them all the time for global data manager classes that need to be accessible from anywhere inside the application. You can create a simple one like this:

@interface NewsArchiveManager : NetworkDataManager
{
}

+ (NewsArchiveManager *) sharedInstance;
@end

@implementation NewsArchiveManager

- (id) init
{
    self = [super init];
    if ( self ) 
    {
         // custom initialization goes here
    }

    return self;
}


+ (NewsArchiveManager *) sharedInstance
{
    static NewsArchiveManager *g_instance = nil;

    if ( g_instance == nil )
    {
        g_instance = [[self alloc] init];
    }

    return g_instance;
}


- (void) dealloc
{
    [super dealloc];
}

@end

相关问答

更多
  • 全局变量在面向对象编程中通常是一个坏主意(单例模式可能是一个可接受的例外,尽管意见各不相同)。 一般而言,您还希望避免共享原始数据并让任何人根据自己的意愿行事 - 您最终需要向每个人提供其他人的内部实施知识,并且管理起来非常困难。 在你的情况下,听起来像LayoutManager是一次性任务(或者每次旋转可能一次?),所以将对象交互短语称为“这是我的观点,请调整它们的大小”并使其成为整个生命周期对象。 所以你要把数组传递给init,你让这个类运行一次然后你就发布它。 如果BlockManager和Color ...
  • 这里的问题是事情发生的顺序。 视图作曲家在匹配视图呈现之前被调用。 这意味着你的情况: 查看home获取呈现 查看作曲家layouts.base被调用 视图layouts.base被渲染 这会导致变量global在home视图中不可用。 以下是一些可能有所帮助的解决方案 改变作曲家模式 将您的作曲家匹配模式更改为包含所有需要该变量的视图。 如果可能,请使用通配符* 。 你甚至可以匹配每个视图: View::composer('*', 'MyApp\Composers\BaseComposer'); 根本不 ...
  • 你最好把它保存在web.config因为这可以在编译后改变。 appSettings元素被保留用于这种功能。 你甚至可以在不同的文件中拆分这部分,所以在你的具体配置中完全清楚这一点。 仅限web.config示例:
  • 在有机会学习Express 3 API Reference之后,我发现我正在寻找什么。 具体来说, app.locals的条目然后还有一个更远的res.locals持有我需要的答案。 我发现自己,函数app.locals接受一个对象,并将其所有属性存储为范围限定于应用程序的全局变量。 这些全局变量作为局部变量传递给每个视图。 然而,函数res.locals范围res.locals请求,因此,响应局部变量只能访问在该特定请求/响应期间呈现的视图。 所以在我的app.js我所做的是添加: app.locals( ...
  • 使用单例类,我总是将它们用于需要从应用程序内部的任何位置访问的全局数据管理器类。 您可以创建一个这样的简单: @interface NewsArchiveManager : NetworkDataManager { } + (NewsArchiveManager *) sharedInstance; @end @implementation NewsArchiveManager - (id) init { self = [super init]; if ( self ) { ...
  • 在App.xaml.cs文件中将它们定义为全局变量。 在App.xaml.cs public static List globalFile; 然后,您可以在应用页面中访问它 App.globalFile 您仍然必须在运行应用程序之前从某处加载这些文件,然后才能使用它们。 Define them as global variables in your App.xaml.cs file. In App.xaml.cs public static List ...
  • 私人成员有趣的是两个相同类型的对象可以自由地访问其他私人成员。 你可以把它想象成一个班级永远是朋友。 既然这是ListData的构造函数, newlist也是ListData ,你可以很好地访问它的私有。 这是一个例子 : #include class foo { public: foo() { } foo(std::string secret) : secret(secret) { } void steal_secret(const foo& other ...
  • 在函数之外声明它们,即全局。 您可能希望将它们放在命名空间/对象/模块中以保证安全。 哪种方法最好取决于您实际使用它们的方式。 例如,如果它们与特定的选择器相关,那么使用.data将它们直接附加到DOM元素可能是“最好的”,或者将它们保存在另一个jQuery函数中等等。 Declare them outside the function, i.e., global. You may want to put them in a namespace/object/module to be on the safe ...
  • 正如@Xatenev在评论中所说,它应该只是在路线中移除$以便改变: Route::get('show_comment/{$id}','CommentsController@showComment'); 至: Route::get('show_comment/{id}','CommentsController@showComment'); As @Xatenev said in the comments, it should just be a case of removing $ in the rou ...
  • 你的init方法需要返回一些东西: -(id) init { self = [super init]; X = malloc(100*sizeof(float)); return self; } 在进行了更改之后(以及在更正main的签名之后),您的程序在我这里运行正常。 不过,你应该对这个错误发出警告或错误。 你是如何构建和测试你的示例程序的? Your init method needs to return something: -(id) init { self = ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)