You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by cristisor <cr...@yahoo.com> on 2013/06/19 13:55:54 UTC

Using BlobMessage with ActiveMQ inside ServiceMix

Hello,

I'm trying to send a file to another computer using ActiveMQ BlobMessages.
The broker starts inside ServiceMix and the transport is:
tcp://localhost:61616?jms.blobTransferPolicy.defaultUploadUrl=http://localhost:8080/temp.
We always get exceptions related to the connection.

Does the defaultUploadUrl mean that there should be a web server where
ActiveMQ will upload the file so that the client can downloaded afterwards?

If yes, can't this be skipped since the file is already on the local
machine, so another copy is not needed?

ActiveMQ version: 5.4.0-fuse-00-00
ServiceMix version: 3.5.0-fuse-00-00

Thanks.




--
View this message in context: http://activemq.2283324.n4.nabble.com/Using-BlobMessage-with-ActiveMQ-inside-ServiceMix-tp4668354.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Using BlobMessage with ActiveMQ inside ServiceMix

Posted by cristisor <cr...@yahoo.com>.
The configuration for embedding the FTP server into ServiceMix
3.6.0-fuse-00-89 is the following:
<beans xmlns:ftp="http://mina.apache.org/ftpserver/spring/v1"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://mina.apache.org/ftpserver/spring/v1 
		http://mina.apache.org/ftpserver/ftpserver-1.0.xsd">
	
	<bean id="listenerFactory"
class="org.apache.ftpserver.listener.ListenerFactory">
		<property name="port" value="2221"/>
		<property name="implicitSsl" value="false"/>
	</bean>
		
	<bean id="userManagerFactory"
class="org.apache.ftpserver.usermanager.PropertiesUserManagerFactory">
		<property name="file" value="classpath:ftpserver-users.properties"/>
	</bean>
		
	<bean id="serverFactory" class="org.apache.ftpserver.FtpServerFactory">
		<property name="listeners">
			<map>
				<entry key="default">
					<bean id="defaultListener" factory-bean="listenerFactory"
factory-method="createListener"/>
				</entry>
			</map>
		</property>
		<property name="userManager">
			<bean id="userManager" factory-bean="userManagerFactory"
factory-method="createUserManager" />
		</property>
	</bean>
	
	<bean id="ftpServer" class="org.apache.ftpserver.FtpServer" 
		factory-bean="serverFactory" factory-method="createServer"
init-method="start" destroy-method="stop" />
</beans>


Sending the blob messages via the ftp server is successful and we are
transferring files with the size close to 100MB very fast and without any
kind of error. For those who are looking to implement this solution, they
can set the upload URL like this:
tcp://localhost:62626?jms.blobTransferPolicy.uploadUrl=ftp://admin:admin@ftpurl:2221/

Sorry for replying so late but the past 2 months were very busy.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Using-BlobMessage-with-ActiveMQ-inside-ServiceMix-tp4668354p4671207.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Using BlobMessage with ActiveMQ inside ServiceMix

Posted by Christian Posta <ch...@gmail.com>.
Thanks for closing the loop. Probably a good choice.


On Tue, Jun 25, 2013 at 1:26 AM, cristisor <cr...@yahoo.com> wrote:

> We have decided to go with an embedded Apache MINA FtpServer for increased
> performance and scalability. I think that the FtpServer is lighter than an
> embedded Jetty server and it servers our needs perfectly.
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Using-BlobMessage-with-ActiveMQ-inside-ServiceMix-tp4668354p4668543.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: Using BlobMessage with ActiveMQ inside ServiceMix

Posted by cristisor <cr...@yahoo.com>.
We have decided to go with an embedded Apache MINA FtpServer for increased
performance and scalability. I think that the FtpServer is lighter than an
embedded Jetty server and it servers our needs perfectly.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Using-BlobMessage-with-ActiveMQ-inside-ServiceMix-tp4668354p4668543.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Using BlobMessage with ActiveMQ inside ServiceMix

Posted by cristisor <cr...@yahoo.com>.
I managed to deploy a component bean like this:
<beans xmlns:bean="http://servicemix.apache.org/bean/1.0">
  <bean:endpoint service="test:service" endpoint="endpoint"
bean="#jettyServer"/>
  <bean id="jettyServer" class="com.rs.sw.nec.JettyServer"/>
</beans>

and inside I start a Jetty server:
package com.rs.sw.nec;

import org.mortbay.jetty.bio.SocketConnector;
import org.mortbay.jetty.webapp.WebAppContext;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Handler;
import org.mortbay.jetty.Server;
import javax.annotation.PostConstruct;

/**
 * A simple bootstrap class for starting Jetty in your IDE using the local
web application.
 *
 * @version $Revision: 356269 $
 */
public class JettyServer {

    public static final int PORT = 8080;

    public static final String WEBAPP_DIR = "src/webapp";

    public static final String WEBAPP_CTX = "/";

    @PostConstruct
        public void main() throws Exception {
        int port = PORT;
        System.out.println("Starting Web Server on port: " + port);
        Server server = new Server();
        SocketConnector connector = new SocketConnector();
        connector.setPort(port);
        WebAppContext webapp = new WebAppContext();
        webapp.setContextPath(WEBAPP_CTX);
        webapp.setResourceBase(WEBAPP_DIR);
        server.setHandlers(new Handler[] { webapp });
        server.setConnectors(new Connector[] { connector });
        server.start();
    }
}

When I deploy it in hotdeploy I see the component starting:
2934081 [Timer-2] INFO org.mortbay.log - Started
SocketConnector@0.0.0.0:8080

but I still can't upload blob messages because it complains that the PUT
method is not supported.

So do I need a fully operational web server? 



--
View this message in context: http://activemq.2283324.n4.nabble.com/Using-BlobMessage-with-ActiveMQ-inside-ServiceMix-tp4668354p4668405.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.