activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy Bish (JIRA)" <>
Subject [jira] Commented: (AMQNET-306) Provide a means of adding new Transports to the TransportFactory either et runtime or via some other mechanism
Date Wed, 12 Jan 2011 22:28:45 GMT


Timothy Bish commented on AMQNET-306:

I'd propose that we use the Attribute method but we should indicate that its a transport factory
being marked as we need to use a factory still to create each transport since the factory
can have a default constructor but the transport might not.


namespace Apache.NMS.ActiveMQ.Transport
    /// <summary>
    /// Attribute that decorates ITransportFactory implementations to allow
    /// the TransportFactory to find all the available factories dynamically.
    /// </summary>

    [AttributeUsage(AttributeTargets.Class, AllowMultiple=false, Inherited=false)]
    public class NMSTransportFactory : Attribute
        private string scheme;
        private string description;

        public NMSTransportFactory(string scheme) : base()
            this.scheme = scheme;

        public string Description
            get { return this.description; }
            set { this.description = value; }


Not sure I'm crazy about the name, can't think of anything better right now though.

public class TcpTransportFactory : ITransportFactory

> Provide a means of adding new Transports to the TransportFactory either et runtime or
via some other mechanism
> --------------------------------------------------------------------------------------------------------------
>                 Key: AMQNET-306
>                 URL:
>             Project: ActiveMQ .Net
>          Issue Type: Improvement
>          Components: ActiveMQ
>    Affects Versions: 1.5.0
>            Reporter: Timothy Bish
>            Assignee: Timothy Bish
>            Priority: Minor
>             Fix For: 1.5.0
> Currently the only way to add new Transports to the Apache.NMS.ActiveMQ.Transport.TransportFactory
is to hard code the mapping between the uri scheme and the ITransportFactory that is used
to create transports of the scheme type.  This makes it difficult to add new transports or
to inject new ones in the tests library for instance.  It would be nice if there was a way
to register new TransportFactory mappings or even better to have the TransportFactory dynamically
discover them.
> One option is to just add a RegisterTransportFactory method that takes a scheme and the
name or type of a class that can later be created when a new ConnectionFactory is instantiated.
> Another options might be to embed the information needed to map a scheme to an ITransportFactory
in the Resources of an assenbly and have the TransportFactory enumerate the loaded assembles
to attempt to find that information.  

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message