Este conteúdo não está disponível no idioma selecionado.
Chapter 2. WS-Notification Tutorial
2.1. Install and Configure the Notification Broker
Copiar o linkLink copiado para a área de transferência!
Overview
Copiar o linkLink copiado para a área de transferência!
				This section of the tutorial describes how to install and configure the notification broker as a Web service in the JBoss A-MQ standalone container. For convenient OSGi deployment, the notification broker is packaged as an Apache Karaf feature.
			
Prerequisites
Copiar o linkLink copiado para a área de transferência!
				This tutorial assumes that you are starting from a plain standalone container, in the initial configuration you find it in after installing JBoss A-MQ (and, in particular, that the container is not configured as part of a Fuse fabric).
			
Steps to install the notification broker
Copiar o linkLink copiado para a área de transferência!
				To install and configure the notification broker in the JBoss A-MQ container, perform the following steps:
			
- Make sure you have already configured some user accounts in theetc/users.propertiesfile. If necessary, create a user account by adding lines in the following format:Username=Password[,Role1][,Role2]... Username=Password[,Role1][,Role2]...Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example, this tutorial assumes that the followingadminuser account is defined (which has privileges defined by theadminrole):admin=admin,admin admin=admin,adminCopy to Clipboard Copied! Toggle word wrap Toggle overflow 
- Create the notification broker configuration file,InstallDir/etc/org.apache.cxf.wsn.cfg, and use a text editor to add the following property settings:cxf.wsn.activemq=vm://amq?create=false&waitForStart=10000 cxf.wsn.activemq.username=admin cxf.wsn.activemq.password=admin cxf.wsn.activemq=vm://amq?create=false&waitForStart=10000 cxf.wsn.activemq.username=admin cxf.wsn.activemq.password=adminCopy to Clipboard Copied! Toggle word wrap Toggle overflow The following aspects of the notification broker are configured in this file:- Connection to the ActiveMQ broker—thevm://amqURL connects through the Java Virtual Machine to access the broker namedamq(where the broker's name is defined by thebroker-namesetting in theetc/org.fusesource.mq.fabric.server-default.cfgfile). The following options are specified on this URL:- create
- By settingcreate=false, you can ensure that the notification broker does not try to create its own (embedded) instance of a broker, but always tries to connect to the existing broker instance namedamq.
- waitForStart
- To compensate for any delays that might occur during the container's start-up sequence, this endpoint defines a grace period, during which it waits for the broker to start.
 
- Credentials for the connection—because authentication is enabled by default in the broker, you must provide credentials (username and password) for connecting to the broker. The credentials must refer to one of the user accounts defined inetc/users.properties.
 
- Start up the JBoss A-MQ container, by entering the following command from theInstallDir/bindirectory:./amq ./amqCopy to Clipboard Copied! Toggle word wrap Toggle overflow 
- Install and start up the notification broker using thefeatures:installconsole command, as follows:JBossA-MQ:karaf@root> features:install cxf-wsn JBossA-MQ:karaf@root> features:install cxf-wsnCopy to Clipboard Copied! Toggle word wrap Toggle overflow 
- Check that broker has started up by navigating to the following URL in your Web browser (querying the WSDL contract from the Web service endpoint):http://localhost:8182/wsn/NotificationBroker?wsdl http://localhost:8182/wsn/NotificationBroker?wsdlCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYour browser should display the NotificationBroker WSDL contract in response to this URL, but this does not work in all browsers. For example, the Safari browser just displays a blank page.
Troubleshooting
Copiar o linkLink copiado para a área de transferência!
				If you are not sure whether the notification broker is running properly, you can get some diagnostic information using the following commands:
			
- osgi:list
- If you runosgi:listat the console prompt, you should see some output like the following:Copy to Clipboard Copied! Toggle word wrap Toggle overflow In particular, the Apache CXF WSN Core bundle (which deploys the notification broker server) must have the statusActiveandCreated.
- log:display
- Run thelog:displaycommand at the console prompt to search the container log for errors and warnings.
org.apache.cxf.wsn.cfg settings
Copiar o linkLink copiado para a área de transferência!
				You can set the following properties in the 
etc/org.apache.cxf.wsn.cfg configuration file:
			- cxf.wsn.activemq
- Specifies the URI for connecting to the ActiveMQ broker (must be an ActiveMQ client URL). Default isvm:localhost.
- cxf.wsn.activemq.username
- Specifies the username credentials for logging on to the ActiveMQ broker. Default isuser.
- cxf.wsn.activemq.password
- Specifies the password credentials for logging on to the ActiveMQ broker. Default ispassword.
- cxf.wsn.rootUrl
- Specifies the host and IP port of the notification broker's Web service endpoints. Default ishttp://0.0.0.0:8182.
- cxf.wsn.context
- Defines the servlet context for notification broker's Web service endpoints. Default is/wsn.By default, the notification broker constructs itsNotificationBrokerendpoint address and itsCreatePullPointendpoint address as follows:${cxf.wsn.rootUrl}${cxf.wsn.context}/NotificationBroker ${cxf.wsn.rootUrl}${cxf.wsn.context}/CreatePullPoint${cxf.wsn.rootUrl}${cxf.wsn.context}/NotificationBroker ${cxf.wsn.rootUrl}${cxf.wsn.context}/CreatePullPointCopy to Clipboard Copied! Toggle word wrap Toggle overflow 
Advanced configuration
Copiar o linkLink copiado para a área de transferência!
				Because the ActiveMQ broker provides the core functionality of the notification broker, most of the configuration options are available in the 
etc/activemq.xml file. For example, through the settings in this file you can configure persistent storage and you can optimize the broker for optimum performance.
			
				For more details, see Managing and Monitoring a Broker and Configuring Broker Persistence.