Tags


Destination (thread-safe, administered obj, from jndi) 
- "used by" msg producer, msg consumer
- hide/map physical name (ie. vendor specific/native) from/to logical name
- although destinations are created using the Session object, 
their lifetime matches the connection from which the session was created. (from AIA)

ConnectionFactory (thread-safe, administered obj, from jndi)
- "creates" connection (map to 1 jms provider)


Connection (thread-safe)
- "creates" session (1 "s"ingle thread, 1 conn to many sessions, each prod or cons needs its own session)
- set ClientID (if Durable) before session creation 
ie. conn.setClientID("username")


Session (NOT thread safe)
- need Destination (ie. Destination, Topic, Queue)
- session creates msg, pdr and csr, pub and sub
- session creates message (create msg from session, used by prod and cons)
- session creates msg producer, msg consumer (created from individual session 1 to 1)


MessageConsumer, MessageProducer (NOT thread safe)
- The point is that the Session, MessageProducer, and MessageConsumer objects 
shouldn’t be shared across threads in a Java application. (from AIA)


Unsubscribe, subscriber/DurableSubscriber
- before unsubscribe, must close subscriber
ie. subs.close(); session.unsubscribe("subname");


Cleanup code
- publisher.close();  session.close(); connection.close();


Messaging Domains
- point to point
- publish/subscribe

Message 
- TextMessage - text
- ObjectMessage - serialized java object
- BytesMessage - native format in bytes
- StreamMessage - stream and formatted with primitive types
- MapMessage - name-value pairs, similar to Properties

Advertisements