zoukankan      html  css  js  c++  java
  • Setting up GlassFish for JMS

    from: https://www.packtpub.com/article/setting-glassfish-jms-working-with-message-queues

    Setting up GlassFish for JMS and Working with MessageQueues

    [ Share this article ]

    Share this page via Facebook, Twitter or LinkedIn.

     
     
     
     
    [ Send this article ]
    [ Save this article ]
    by David R. Heffelfinger | July2010 | Java Open Source

    The JavaMessaging API (JMS)provides a mechanism for Java EE applications to send messages toeach other. JMS applications do not communicate directly, insteadmessage producers send messages to a destination and messageconsumers receive the message from the destination.

    The message destination is a message queue when the point-to-point(PTP) messaging domain is used, or a message topic when thepublish/subscribe (pub/sub) messaging domain is used.

    In this article by DavidHeffelfinger, author of the book JavaEE 6 with GlassFish 3 Application Server, we will cover thefollowing topics:

    • Setting up GlassFish for JMS
    • Working with message queues
     

    (For more resources on Java, see here.)

    Setting up GlassFish for JMS

    Before we start writing code to take advantage of the JMS API, weneed to configure some GlassFish resources. Specifically, we needto set up a JMSconnection factory, a messagequeue, and a messagetopic.

    Setting up a JMS connection factory

    The easiest way to set up a JMS connection factory is viaGlassFish's web console. The web console can be accessed bystarting our domain, by entering the following command in thecommand line:

    asadmin start-domain domain1
    

    Then point the browser to http://localhost:4848 andlog in:

    Setting up GlassFish for JMS and Working with Message Queues

    A connection factory can be added by expandingthe Resources nodein the tree at the left-hand side of the web console, expandingthe JMSResources node and clicking onthe ConnectionFactories node, then clicking onthe New...button in the main area of the web console.

    Setting up GlassFish for JMS and Working with Message Queues

    For our purposes, we can take most of the defaults. The only thingwe need to do is enter aPoolName and pick a ResourceType for our connection factory.

    It is always a good idea to use a PoolName starting with "jms/" when picking a namefor JMS resources. This way JMS resources can be easily identifiedwhen browsing a JNDI tree.

    In the text field labeled PoolName, enter jms/GlassFishBookConnectionFactory.Our code examples later in this article will use this JNDI name toobtain a reference to this connection factory

  • 相关阅读:
    微信公众平台接口测试账号申请
    Windows平台下tomcat+java的web程序持续占cpu问题调试
    mysql存储过程基础
    Mysql权限控制
    MySQL开启federated引擎实现数据库表映射
    JAVA中Set集合--HashSet的使用
    在js中嵌套java代码
    MySql计算两个日期的时间差函数
    关于easyui combobox下拉框实现多选框的实现
    利用excel办公软件快速拼凑sql语句
  • 原文地址:https://www.cnblogs.com/leeeee/p/7276719.html
Copyright © 2011-2022 走看看