Hi This seems like a permission/security setting. That your JMS broker denies sending to non existing topics. > javax.jms.InvalidDestinationException: Not allowed to create destination
You may need to create the destination on the JMS broker using its admin interface for that. On Wed, Apr 25, 2012 at 9:11 PM, Gershaw, Geoffrey <[email protected]> wrote: > Hello, > > > > I am trying to do what the subject of this mail says. I have looked at > the documentation on the JMS component @ > http://camel.apache.org/jms.html. > > > > I have a collection of Publishable objects. Publishable objects have > > > > 1. A method that returns the Topic name postfix. > > 2. A method that returns a Map<String,String> of properties to put > as JMS Headers > > > > Based on what I read, I created the below class. I am using the > ProducerTemplate to publish > > > > > > public class GenericCamelPublisher { > > private ProducerTemplate jmsProducer; > > private static final Logger log = > Logger.getLogger(GenericCamelPublisher.class); > > private String destinationPrefix; > > private String endPointUri; > > > > public GenericCamelPublisher(ProducerTemplate jmsProducer, String > destinationPrefix, String endPointUri){ > > this.jmsProducer = jmsProducer; > > this.destinationPrefix = destinationPrefix; > > this.endPointUri = endPointUri; > > } > > > > public void publish(Publishable publishable){ > > Map<String,String> origMsgHeaders = > publishable.getPublishProperties(); > > Map<String,Object> msgHeaders = new HashMap<String, > Object>(origMsgHeaders); > > String destinationName = null; > > > > if(!StringUtils.isEmpty(destinationPrefix)){ > > destinationName = String.format("%s.%s", > destinationPrefix, publishable.getPublishTopicName()); > > }else{ > > destinationName = publishable.getPublishTopicName(); > > } > > > > if(log.isDebugEnabled()){ > > log.debug("Destination is " + destinationName); > > } > > msgHeaders.put(JmsConstants.JMS_DESTINATION_NAME, > destinationName); > > jmsProducer.sendBodyAndHeaders(endPointUri, > publishable.getPayload(), msgHeaders); > > } > > } > > > > I receive the following output > > > > 15:03:46,115 [QFJ Message Processor] DEBUG > com.csfb.oddlots.creditex.md.GenericCamelPublisher - Destination is > T.NY.COLT.FBID.REDC.2I65BYCO1 > > 15:03:46,115 [QFJ Message Processor] DEBUG > org.apache.camel.impl.DefaultComponent - Creating endpoint > uri=[jmsUS://topic], path=[topic], parameters=[{}] > > 15:03:46,116 [QFJ Message Processor] DEBUG > org.apache.camel.spring.SpringCamelContext - jmsUS://topic converted to > endpoint: Endpoint[jmsUS://topic] by component: > org.apache.camel.component.jms.JmsComponent@1d281f1 > > 15:03:46,117 [QFJ Message Processor] DEBUG > org.apache.camel.component.jms.JmsProducer - Starting producer: > Producer[jmsUS://topic] > > 15:03:46,117 [QFJ Message Processor] DEBUG > org.apache.camel.impl.ProducerCache - Adding to producer cache with > key: Endpoint[jmsUS://topic] for producer: Producer[jmsUS://topic] > > 15:03:46,120 [QFJ Message Processor] DEBUG > org.apache.camel.impl.ProducerCache - >>>> Endpoint[jmsUS://topic] > Exchange[Message: > 8=FIXT.1.19=17835=S15=USD22=R48=2I65BYCO155=60200560=20120425-19:03:46.0 > 51117=15648175132=95134=50000167=INDEX_CDS423=6537=1632=0647=06372=Y7100 > =CX7101=UPD7102=156481757528=010=202] > > 15:03:46,316 [QFJ Message Processor] DEBUG > org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate - > Executing callback on JMS Session: > com.tibco.tibjms.TibjmsxSessionImp@1846149 > > 15:03:46,377 [QFJ Message Processor] WARN > org.apache.camel.processor.UnitOfWorkProcessor - Caught unhandled > exception while processing ExchangeId: > ID-USD09546426-64302-1335380610999-0-4234 > > org.springframework.jms.InvalidDestinationException: Not allowed to > create destination; nested exception is > javax.jms.InvalidDestinationException: Not allowed to create destination > > at > org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUt > ils.java:285) > > at > org.springframework.jms.support.JmsAccessor.convertJmsAccessException(Jm > sAccessor.java:168) > > at > org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:469) > > > > I have seen this exception if I try to publish to a topic that does not > begin with T.NY.COLT. It's a permissioning thing. > > In this case, the logs don't tell where the jmsEndpoint tried to publish > too. > > > > Am I approaching this the wrong way? > > > > Thanks in advance, > > > Geoff > > > > > > > > Geoffrey A. Gershaw > > > > > =============================================================================== > Please access the attached hyperlink for an important electronic > communications disclaimer: > http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html > =============================================================================== > -- Claus Ibsen ----------------- CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: [email protected] Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
