Apollo API != ActiveMQ 5.x API.

To create an embedded broker with ActiveMQ 5.x with SSL take a look at this:
https://github.com/apache/activemq/blob/trunk/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AMQ4563Test.java#createBroker(...)


To create an embedded broker with Apollo with SSL use the BrokerDTO
object to set configuration options. Then
do:

val broker = new Broker
broker.config = brokerDto
ServiceControl.start(broker, "apollo-broker")

or could use a specific apollo.xml file and load it up like this:
val broker = BrokerFactory.createBroker("xml:classpath:path/to/apollo.xml")

The DTO objects required for the config allow you to set ssl
keystore/truststore properties.
Take a look at the API:
http://activemq.apache.org/apollo/documentation/api/apollo-dto/index.html
http://activemq.apache.org/apollo/documentation/api/apollo-dto/index.html

also check the apollo docs for ssl config:
http://activemq.apache.org/apollo/documentation/user-manual.html#The_SSL_TLS_Transport

On Fri, Nov 22, 2013 at 10:11 AM, Brian Reinhold
<brianreinh...@lampreynetworks.com> wrote:
> This question was asked a while ago and the answers involved links and APIs
> that no longer exist. I am unable to find any documentation to figure out
> what classes correspond to what xml options, and if one is able to guess at
> the classes, how to link them to the broker.
>
> In the binary distributions an embedded example is given. It uses the Broker
> class and not the BrokerService (as shown in the ActiveMQ FAQ). However, in
> the context of an Apollo distribution, using the BrokerService as shown in
> the ActiveMQ FAQ fails due to missing administrative classes.
>
> In the example of the distribution, the Broker.setConfig(BrokerDTO) method
> is used.
>
> The main method creates the embedded broker as follows:
>
>         System.out.println("Starting the Broker.");
>         broker = new Broker();
>         broker.setConfig(createBrokerConfig());
>         broker.start(new Runnable()
>                     {
>                         public void run()
>                         {
>                             System.out.println("The broker has now
> started.");
>                         }
>                     });
>
> calling the createBrokerConfig method which creates the BrokerDTO object:
>
>     private static BrokerDTO createBrokerConfig()
>     {
>         BrokerDTO broker = new BrokerDTO();
>
>         // Brokers support multiple virtual hosts.
>         VirtualHostDTO host = new VirtualHostDTO();
>         host.id = "localhost";
>         host.host_names.add("localhost");
>         host.host_names.add("127.0.0.1");
>
>         // The message store is configured on the virtual host.
>         LevelDBStoreDTO store = new LevelDBStoreDTO();
>         store.directory = new File("./data");
>         host.store = store;
>
>         broker.virtual_hosts.add(host);
>
>         //
>         // Control which ports and protocols the broker binds and accepts
>         AcceptingConnectorDTO connector = new AcceptingConnectorDTO();
>         connector.id = "tcp";
>         connector.bind = mqttServerUrl;
>
>         broker.connectors.add(connector);
>
>         //
>         // Fires up the web admin console on HTTP.
>         WebAdminDTO webadmin = new WebAdminDTO();
>         webadmin.bind = "http://127.0.0.1:61680";;
>         broker.web_admins.add(webadmin);
>
>         return broker;
>     }
>
> This simple code does create an unsecure broker.
>
> I cannot for the life of me figure out how to place SSL configuration
> information into the broker. I see this class:
>
>         // From
> http://activemq.apache.org/apollo/documentation/api/apollo-dto/index.html
>         SslDTO sslDto = new SslDTO();
>         sslDto.client_auth = "NEED";
>         sslDto.version = "TLSv1";
>
> but I have no idea how to link it to the BrokerDTO object. What I then
> really need to do is to link the javax SslContextFactory to the
> configuration info. But I have no idea how to do that.
>
> I see some older posts that used the BrokerService class which used to have
> an SslBrokerContext that could use the SslContextFactory but that class no
> longer exists.
>
> Though there is oodles of xml configuration information, there is almost no
> documentation of information on using code to control/configure the embedded
> option. Would really appreciate some help here!
>
> Thanks,
>
> Brian
>
>
>
>
>
>
>
>
> --
> View this message in context: 
> http://activemq.2283324.n4.nabble.com/How-to-configure-embedded-SSL-broker-using-just-Java-code-tp4674768.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



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

Reply via email to