From users-return-15339-apmail-activemq-users-archive=activemq.apache.org@activemq.apache.org Thu Aug 07 12:19:35 2008 Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 12182 invoked from network); 7 Aug 2008 12:19:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Aug 2008 12:19:35 -0000 Received: (qmail 54572 invoked by uid 500); 7 Aug 2008 12:19:33 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 54555 invoked by uid 500); 7 Aug 2008 12:19:33 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 54544 invoked by uid 99); 7 Aug 2008 12:19:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Aug 2008 05:19:33 -0700 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of marco.buss@gmx.de designates 213.165.64.20 as permitted sender) Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 07 Aug 2008 12:18:35 +0000 Received: (qmail invoked by alias); 07 Aug 2008 12:19:01 -0000 Received: from p57B96B5E.dip.t-dialin.net (EHLO [127.0.0.1]) [87.185.107.94] by mail.gmx.net (mp021) with SMTP; 07 Aug 2008 14:19:01 +0200 X-Authenticated: #3130569 X-Provags-ID: V01U2FsdGVkX1/yfDorWEHyoFiJg1D6AlK/7Rn4HtaJOV8VsBbBgj rsLMKyIr1cMJGy Message-ID: <489AE820.8050706@gmx.de> Date: Thu, 07 Aug 2008 14:18:40 +0200 From: Marco Buss User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: users@activemq.apache.org Subject: Re: Broker upload url is null? References: <20080807090046.GA2208@office.redwerk.com> <489AD967.6050804@gmx.de> <20080807115543.GA8832@office.redwerk.com> In-Reply-To: <20080807115543.GA8832@office.redwerk.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.45 X-Virus-Checked: Checked by ClamAV on apache.org Eugeny N Dzhurinsky schrieb: > On Thu, Aug 07, 2008 at 01:15:51PM +0200, Marco Buss wrote: > >> Is the Blob successfuly uploaded? Can you see it in the jetty file system? >> > > No, the blob isn't uploaded at all. Moreover, I added the code listed below: > > =============================================================================== > private BlobTransferPolicy getTransferPolicy() { > BlobTransferPolicy policy = new BlobTransferPolicy(); > policy.setUploadStrategy(new DefaultBlobUploadStrategy(policy) { > > @Override > public void deleteFile(ActiveMQBlobMessage message) > throws IOException, JMSException { > System.err.println("Removing file"); > super.deleteFile(message); > } > > @Override > public URL uploadFile(ActiveMQBlobMessage message, File file) > throws JMSException, IOException { > System.err.println("Uploading file"); > return super.uploadFile(message, file); > } > > @Override > public URL uploadStream(ActiveMQBlobMessage arg0, InputStream arg1) > throws JMSException, IOException { > System.err.println("Uploading stream"); > return super.uploadStream(arg0, arg1); > } > > }); > return policy; > } > > .... > > public void run() { > final ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory( > "tcp://localhost:1235"); > final BlobTransferPolicy policy = getTransferPolicy(); > factory.setBlobTransferPolicy(policy); > try { > final ActiveMQConnection connection = (ActiveMQConnection) factory > .createConnection(); > System.out.println("Using upload url = " > + policy.getDefaultUploadUrl()); > connection.setBlobTransferPolicy(policy); > connection.start(); > final ActiveMQSession session = (ActiveMQSession) connection > .createSession(false, Session.CLIENT_ACKNOWLEDGE); > session.setBlobTransferPolicy(policy); > final Destination destination = session > .createQueue(ImageProcessorInterface.srcImgQueueName); > final Destination tempDestination = session.createTemporaryQueue(); > final MessageProducer producer = session > .createProducer(destination); > final MessageConsumer responseConsumer = session > .createConsumer(tempDestination); > responseConsumer.setMessageListener(new MessageListener() { > producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); > for (int i = 0; i < MESSAGES_NUMBER; i++) { > InputStream data = ImageProducer.class > .getResourceAsStream("/sample_image.jpg"); > System.out.println("Data stream is " + data); > final BlobMessage message = session.createBlobMessage(data); > message.setJMSReplyTo(tempDestination); > message.setJMSCorrelationID(generateMsgId()); > producer.send(message); > Thread.sleep(SLEEP_TIME); > } > } catch (final Exception e) { > throw new RuntimeException(e); > } > System.out.println("Done"); > } > =============================================================================== > > to inject a custom BlobTransferPolicy into ActiveMQConnectionFactory, > ActiveMQConnection and ActiveMQSession instances - but as far as I can see, > there's noting about an attempt to upload the file in logs. At this point I'm > stuck :) > > Hello, First try this. Set CopyMessageOnSend to false on your connection. See http://www.nabble.com/A-problem-with-blobmessage-on-activemq-5.0-td15523989.html#a17364301 If this is true (default) the Upload does not work. If that will not help please provied the whole code including the broker an jetty start. I think you will start the broker and jetty programmaticaly. regards Marco