@@ -0,0 +1,1915 @@
+package de.gernd.defaultexchange;%0A%0Aimport com.rabbitmq.client.*;%0A%0Aimport java.io.IOException;%0Aimport java.util.concurrent.Executors;%0Aimport java.util.concurrent.TimeUnit;%0Aimport java.util.concurrent.TimeoutException;%0A%0Apublic class DefaultExchangeDemo %7B%0A%0A    public static final String QUEUE_NAME = %22defaultExchangeQueue%22;%0A%0A    /**%0A     * continuously sends messages using the default exchange%0A     */%0A    public static void main(String%5B%5D args) throws IOException, TimeoutException, InterruptedException %7B%0A%0A        // set up sending connection to rabbitmq broker%0A        ConnectionFactory factory = new ConnectionFactory();%0A        factory.setHost(%22localhost%22);%0A        Connection rabbitMqConnection = factory.newConnection();%0A%0A        // declare queue%0A        Channel channel = rabbitMqConnection.createChannel();%0A        channel.queueDeclare(QUEUE_NAME, false, false, false, null);%0A%0A        // start sending random messages%0A        Executors.newSingleThreadScheduledExecutor().scheduleAtFixedRate(new DefaultExchangeRandomMessageSender%0A                (channel), 0, 5, TimeUnit.SECONDS);%0A%0A        // set up message consumption for test queue%0A        // messages for direct exchanges (as e.g. the default exchange) are load balanced%0A        // amongst consumers and not queues. if we had an additional consumer here,%0A        // the messages would be delivered in a round-robin manner%0A        Consumer messageConsumer = new DefaultConsumer(channel) %7B%0A%0A            @Override%0A            public void handleDelivery(String consumerTag, Envelope envelope,%0A                                       AMQP.BasicProperties properties, byte%5B%5D body)%0A                    throws IOException %7B%0A                String receivedMessage = new String(body, %22UTF-8%22);%0A                System.out.println(%22Got message: %22 + receivedMessage);%0A            %7D%0A%0A        %7D;%0A        channel.basicConsume(QUEUE_NAME, true, messageConsumer);%0A    %7D%0A%7D%0A

Rename DefaultExchange -> DefaultExchangeDemo