zoukankan      html  css  js  c++  java
  • Message Queue vs. Web Services?

     From stackoverflow.com 


    When you use a web service you have a client and a server:

    1. If the server fails the client must take responsibility to handle the error.
    2. When the server is working again the client is responsible of resending it.
    3. If the server gives a response to the call and the client fails the operation is lost.
    4. You don't have contention, that is: if million of clients call a web service on one server in a second, most probably your server will go down.
    5. You can expect an immediate response from the server, but you can handle asynchronous calls too.

    When you use a message queue like RabbitMQ, Beanstalkd, ActiveMQ, IBM MQ Series, Tuxedo you expect different and more fault tolerant results:

    1. If the server fails, the queue persist the message (optionally, even if the machine shutdown).
    2. When the server is working again, it receives the pending message.
    3. If the server gives a response to the call and the client fails, if the client didn't acknowledge the response the message is persisted.
    4. You have contention, you can decide how many requests are handled by the server (call it worker instead).
    5. You don't expect an immediate synchronous response, but you can implement/simulate synchronous calls.

    Message Queues has a lot more features but this is some rule of thumb to decide if you want to handle error conditions yourself or leave them to the message queue.

  • 相关阅读:
    pom
    Java API操作Hadoop可能会遇到的问题以及解决办法
    hadoop在windows上的配置文件
    UNC路径
    spark在windows的配置
    Oracle系统表整理+常用SQL语句收集(转载)
    sbt配置文件
    (转)Flink简介
    spark osx:WARN NativeCodeLoader:62
    试图加载格式不正确的程序。 (异常来自HRESULT:0x8007000B)
  • 原文地址:https://www.cnblogs.com/mysic/p/5472774.html
Copyright © 2011-2022 走看看