package net.kencochrane.raven.appengine;

import net.kencochrane.raven.DefaultRavenFactory;
import net.kencochrane.raven.appengine.connection.AppEngineAsyncConnection;
import net.kencochrane.raven.connection.Connection;
import net.kencochrane.raven.dsn.Dsn;

/**
 * RavenFactory dedicated to create async connections within Google App Engine.
 */
public class AppEngineRavenFactory extends DefaultRavenFactory {
    /**
     * Option for the queue name used in Google App Engine of threads assigned for the connection.
     */
    public static final String QUEUE_NAME = "raven.async.gaequeuename";

    /**
     * Encapsulates an already existing connection in an {@link AppEngineAsyncConnection} and get the async options
     * from the Sentry DSN.
     *
     * @param dsn        Data Source Name of the Sentry server.
     * @param connection Connection to encapsulate in an {@link AppEngineAsyncConnection}.
     * @return the asynchronous connection.
     */
    @Override
    protected Connection createAsyncConnection(Dsn dsn, Connection connection) {
        AppEngineAsyncConnection asyncConnection = new AppEngineAsyncConnection(connection);

        if (dsn.getOptions().containsKey(QUEUE_NAME)) {
            asyncConnection.setQueue(dsn.getOptions().get(QUEUE_NAME));
        }

        return asyncConnection;
    }
}

@@ -591,16 +591,620 @@
 uename%22;
+%0A    /**%0A     * Option to define the identifier of the async connection across every instance of the application.%0A     * %3Cp%3E%0A     * It is important to set a different connection identifier for each opened connection to keep the uniqueness%0A     * of connection ID.%0A     * %3C/p%3E%0A     * %3Cp%3E%0A     * If the connection identifier is not specified, the system will define a connection identifier itself, but its%0A     * uniqueness within an instance isn't guaranteed.%0A     * %3C/p%3E%0A     * %7B@see AppEngineAsyncConnection%7D%0A     */%0A    public static final String CONNECTION_IDENTIFIER = %22raven.async.gae.connectionid%22;
 %0A%0A    /*
@@ -1654,24 +1654,314 @@
 nnection) %7B%0A
+        String connectionIdentifier;%0A        if (dsn.getOptions().containsKey(QUEUE_NAME)) %7B%0A            connectionIdentifier = dsn.getOptions().get(CONNECTION_IDENTIFIER);%0A        %7D else %7B%0A            connectionIdentifier = AppEngineRavenFactory.class.getCanonicalName() + dsn;%0A        %7D%0A%0A
         AppE
@@ -2028,16 +2028,38 @@
 nection(
+connectionIdentifier, 
 connecti

Use the connectionId provided by the user in the AppEngineRavenFactory