I don't have much of a socket programming experience but I tried read a little about it. I am quite familiar with MDB and messaging queues. Someone has told me that queue(e.g. MDB) is "Not much more than a direct socket connection". Can someone compare these two for me.
Message queues can significantly simplify coding of decoupled applications, while improving performance, reliability and scalability.
Message queues provide means for the different applications to push information to the queue. The message broker simply takes the information from the sender, translates it between different messaging protocols, if needed, and delivers the message to the correct receiver.
Shared memory can be deemed as faster (low overhead, high volume of data passing) then queues. But queues on the other hand, requires high overhead (the set up for making a queue to be permanent etc) with low volume of data.
Cons. Increased Complexity: Introduction of message queues to a system architecture increases the overall complexity of the system. Ensuring data consistency and managing the network between the components For simple applications with a limited number of users, message queues might be an overkill.
The two are incomparable, as they represent different layers. It's like comparing a relational database to a file on a disk or comparing a house to a brick (i.e. certainly you need files to build databases and bricks to build houses, and sometimes all you need is a file or a brick, but that does not make them comparable).
Messaging queue is a piece of software that glues senders and receivers so that they can communicate without knowing much about each other (they both need to know about the queue, of course) and do not need to implement networking code, handling failure, routing one message to many receivers etc. The system works even if senders and receivers are never alive at the same time, as queues also serve as a temporary storage for undelivered messages. Aside from that, queues can provide additional services, like authorization, transactions etc.
A socket connection is a low-level network abstraction that says: "currently two programs can send data over a network to each other, at least until connection breaks for some reason". So yes, usually a messaging queue will use a socket connection to work across a network.
By the way: MDB (Message Driven Bean) that you mention is not a message queue (just like JDBC isn't a databasae). It's an API for consuming transactional messages. They may come from a queue, but they don't have to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With