steps to publish to a topic for BrokerFilter-based classes?
Hello, I'm working on a Broker interceptor class that extends BrokerFilter. After processing an incoming message, I would like to publish to a topic that is determined from the content of the message. My question is: is there a quicker way to publish to a topic from a Broker than the standard method a client uses to publish (getting connection, TopicSession, TopicPublisher, and then using the TopicPublisher to publish)? Thanks! -- J. Patrick Bedell [EMAIL PROTECTED] http://infoeng.sourceforge.net http://rothbardix.blogspot.com
communicating with Topic subscribers from custom interceptor class
Hello, Thanks for your great work on ActiveMQ! I'm writing a custom interceptor that extends BrokerFilter in order to process messages that are published to particular Topics. My question is, how can my interceptor make a direct connection with the JMS client that published the message? Does the subscriber have to manually set an identifier in order to be accessible, or are the identifiers automatically generated? Additionally, is there a way to access the list of subscribers to a particular topic and send messages to individual subscribers from a custom interceptor class? Thanks again for your work! -- J. Patrick Bedell [EMAIL PROTECTED] http://infoeng.sourceforge.net http://rothbardix.blogspot.com
Re: communicating with Topic subscribers from custom interceptor class
Hello, On 11/27/06, James Strachan [EMAIL PROTECTED] wrote: On 11/27/06, J. Patrick Bedell [EMAIL PROTECTED] wrote: I'm writing a custom interceptor that extends BrokerFilter in order to process messages that are published to particular Topics. My question is, how can my interceptor make a direct connection with the JMS client that published the message? What kind of thing are you trying to do? The custom interceptor creates a marketplace, and clients send digital financial instruments. The interceptor must keep track of the originator of the messages that include these assets, because the client must be able to retrieve its asset from the interceptor when it chooses. Also, the interceptor must be able to initiate messages to a client when a trade has been executed, to inform them of the execution of a trade and to deliver the result. What I would really like to do is have some way of, from the interceptor, initiate communication with a subscriber that has previously sent a message that is published to a Topic that is processed by the interceptor. Does the subscriber have to manually set an identifier in order to be accessible, or are the identifiers automatically generated? Subscribers are visible in JMX or the BrokerService via their unique generated consumerId's. Should I just expect the clients to subscribe to a per-client queue so that there is a per-client control channel, so that the market server (i.e., the interceptor class) can communicate with the client? Additionally, is there a way to access the list of subscribers to a particular topic and send messages to individual subscribers from a custom interceptor class? Not easily. What are you trying to do - maybe there's an easier way. Thanks again! Patrick James --- http://radio.weblogs.com/0112098/ -- J. Patrick Bedell [EMAIL PROTECTED] http://infoeng.sourceforge.net http://rothbardix.blogspot.com
obtaining a DataSource bean from a BrokerFilter-based plugin?
Hi, I'm trying to utilize (in the attached activemq configuration file) the derby-ds DataSource that is commented out in the default configuration, which has the bean element bean id=derby-ds class=org.apache.derby.jdbc.EmbeddedDataSource property name=databaseName value=derbydb/ property name=createDatabase value=create/ /bean I'm also writing an interceptor that extends BrokerFilter, so that I can have an ActiveMQ-specific plugin. My question is, how would I obtain the derby-ds DataSource in my BrokerFilter-based plugin? (I have the suspicion that this is an extremely simple question, but I don't know the answer and I'm not familiar enough with Spring to find it. :) Thanks! -- J. Patrick Bedell [EMAIL PROTECTED] http://infoeng.sourceforge.net http://rothbardix.blogspot.com !-- START SNIPPET: example -- beans xmlns=http://activemq.org/config/1.0; xmlns:p=java://org.infoeng.ictp.test !-- Allows us to use system properties as variables in this configuration file -- bean class=org.springframework.beans.factory.config.PropertyPlaceholderConfigurer/ jetty xmlns=http://mortbay.com/schemas/jetty/1.0; connectors nioConnector port=8181 / /connectors handlers webAppContext contextPath=/ resourceBase=webapp parentLoaderPriority=false / /handlers /jetty broker useJmx=true !-- Use the following to set the broker memory limit (in bytes) memoryManager usageManager id=memory-manager limit=1048576/ /memoryManager -- !-- Use the following to configure how ActiveMQ is exposed in JMX managementContext managementContext connectorPort=1099 jmxDomainName=org.apache.activemq/ /managementContext -- plugins p:TestICTPInterceptor / /plugins !-- In ActiveMQ 4, you can setup destination policies -- destinationPolicy policyMappolicyEntries policyEntry topic=FOO. dispatchPolicy strictOrderDispatchPolicy / /dispatchPolicy subscriptionRecoveryPolicy lastImageSubscriptionRecoveryPolicy / /subscriptionRecoveryPolicy /policyEntry /policyEntries/policyMap /destinationPolicy persistenceAdapter journaledJDBC journalLogFiles=5 dataDirectory=${activemq.home}/activemq-data/ !-- To use a different datasource, use th following syntax : -- !-- journaledJDBC journalLogFiles=5 dataDirectory=../activemq-data dataSource=#postgres-ds/ -- /persistenceAdapter transportConnectors transportConnector name=default uri=tcp://localhost:61616 discoveryUri=multicast://default/ transportConnector name=stomp uri=stomp://localhost:61613/ /transportConnectors networkConnectors !-- by default just auto discover the other brokers -- networkConnector name=default uri=multicast://default/ !-- networkConnector name=host1 and host2 uri=static://(tcp://host1:61616,tcp://host2:61616) failover=true/ -- /networkConnectors /broker !-- This xbean configuration file supports all the standard spring xml configuration options -- !-- Postgres DataSource Sample Setup -- !-- bean id=postgres-ds class=org.postgresql.ds.PGPoolingDataSource property name=serverName value=localhost/ property name=databaseName value=activemq/ property name=portNumber value=0/ property name=user value=activemq/ property name=password value=activemq/ property name=dataSourceName value=postgres/ property name=initialConnections value=1/ property name=maxConnections value=10/ /bean -- !-- MySql DataSource Sample Setup -- !-- bean id=mysql-ds class=org.apache.commons.dbcp.BasicDataSource destroy-method=close property name=driverClassName value=com.mysql.jdbc.Driver/ property name=url value=jdbc:mysql://localhost/activemq?relaxAutoCommit=true/ property name=username value=activemq/ property name=password value=activemq/ property name=poolPreparedStatements value=true/ /bean -- !-- Embedded Derby DataSource Sample Setup -- bean id=derby-ds class=org.apache.derby.jdbc.EmbeddedDataSource property name=databaseName value=derbydb/ property name=createDatabase value=create/ /bean !-- bean id=Server class=org.mortbay.jetty.Server init-method=start destroy-method=stop property name=connectors list bean id=Connector class=org.mortbay.jetty.nio.SelectChannelConnector property name=port value=8181/ /bean /list /property property name=handler bean id=handlers class=org.mortbay.jetty.handler.HandlerCollection property name=handlers list bean id=contexts class=org.mortbay.jetty.handler.ContextHandlerCollection property name=handlers list bean class=org.mortbay.jetty.webapp.WebAppContext property name=contextPath
Re: newbie request for help - custom server implementation in ActiveMQ?
Hi, I'm afraid that I can't blame you. :) I would like to have a filter placed within the processing of messages sent to a particular set of topics, where messages to a particular topic are processed (in an application-specific way) to remove certain information from the incoming message before it is relayed to all the subscribers to the topic. i.e., I would like to receive the XML applicationMessage publicInfoblah blah/publicInfo secretInfosqueamish ossifrage/secretInfo /applicationMessage published to a topic X, and relay to all the subscribers to topic X the processed message applicationMessage publicInfoblah blah/publicInfo /applicationMessage My questions are, what interface should the modifying class implement, and what modifications would I make to the activemq.xml configuration file so that the class modifies the received XML appropriately? Are there any pointers to similar application requirements that others can provide? Thanks very much! Patrick [EMAIL PROTECTED] P.S.: FWIW, the development of information currency is my attempt to create new ways to recognize and value the contributions of open-source developers - think of information currency as stock shares for information, such as individual commits to the ActiveMQ svn repository. The sooner I've got this trading application developed, the sooner I can express my deep appreciation for your work in terms of prices, in addition to words of thanks and development decisions based on your outstanding work. :) On 11/9/06, James Strachan [EMAIL PROTECTED] wrote: On 11/9/06, J. Patrick Bedell [EMAIL PROTECTED] wrote: Hello, I am interested in using ActiveMQ to develop a market for information currency (http://infoeng.sourceforge.net). I'm a real ActiveMQ/Spring newbie, so I'm not very clear on how to create a POJO to serve as a filter for certain messages sent to the server. I don't really understand the question I'm afraid. -- James --- http://radio.weblogs.com/0112098/
newbie request for help - custom server implementation in ActiveMQ?
Hello, I am interested in using ActiveMQ to develop a market for information currency (http://infoeng.sourceforge.net). I'm a real ActiveMQ/Spring newbie, so I'm not very clear on how to create a POJO to serve as a filter for certain messages sent to the server. Can anyone recommend a good introduction to creating a custom server using JMS? (Sorry if the question is open-ended and ill-defined!) Patrick [EMAIL PROTECTED]