TIBCO EMS QuickStart

Add additional constructors to ConnectionFactory
Remove comments referring to 'NMS'
This commit is contained in:
markpollack
2009-06-18 06:49:31 +00:00
parent a8b6e5feff
commit 04ac4aec80
10 changed files with 53 additions and 30 deletions

View File

@@ -19,6 +19,7 @@
#endregion
using System;
using System.Collections;
using System.IO;
using System.Runtime.Serialization;
using Spring.Objects.Factory;
@@ -35,7 +36,23 @@ namespace Spring.Messaging.Ems.Common
private string sslProxyHost;
private int sslProxyPort;
public EmsConnectionFactory()
{
this.nativeConnectionFactory = new ConnectionFactory();
}
public EmsConnectionFactory(string serverUrl) : this(serverUrl, null, null)
{
}
public EmsConnectionFactory(string serverUrl, string clientId) : this(serverUrl, clientId, null)
{
}
public EmsConnectionFactory(string serverUrl, string clientId, Hashtable properties)
{
this.nativeConnectionFactory = new ConnectionFactory(serverUrl, clientId, properties);
}
public EmsConnectionFactory(ConnectionFactory nativeConnectionFactory)
{
@@ -196,11 +213,6 @@ namespace Spring.Messaging.Ems.Common
set { nativeConnectionFactory.SetSSLAuthOnly(value); }
}
public void SetSSLProxy(string host, int port)
{
nativeConnectionFactory.SetSSLProxy(host, port);
}
public string SSLProxyAuthUsername
{
set { this.sslProxyAuthUsername = value; }
@@ -248,10 +260,17 @@ namespace Spring.Messaging.Ems.Common
#region Implementation of IInitializingObject
public void AfterPropertiesSet()
{
nativeConnectionFactory.SetSSLProxyAuth(this.sslProxyAuthUsername, this.sslProxyAuthPassword);
nativeConnectionFactory.SetSSLProxy(this.sslProxyHost, this.sslProxyPort);
public void AfterPropertiesSet() {
if (this.sslProxyAuthUsername != null && sslProxyAuthPassword != null)
{
nativeConnectionFactory.SetSSLProxyAuth(this.sslProxyAuthUsername, this.sslProxyAuthPassword);
}
if (sslProxyHost != null && sslProxyPort != null)
{
nativeConnectionFactory.SetSSLProxy(this.sslProxyHost, this.sslProxyPort);
}
}
#endregion

View File

@@ -24,7 +24,7 @@ using Spring.Objects.Factory.Xml;
namespace Spring.Messaging.Ems.Config
{
/// <summary>
/// Namespace parser for the nms namespace.
/// Namespace parser for the EMS namespace.
/// </summary>
/// <author>Mark Fisher</author>
/// <author>Juergen Hoeller</author>

View File

@@ -25,7 +25,7 @@ using TIBCO.EMS;
namespace Spring.Messaging.Ems.Connections
{
/// <summary>
/// NMS MessageConsumer decorator that adapts all calls
/// EMS MessageConsumer decorator that adapts all calls
/// to a shared MessageConsumer instance underneath.
/// </summary>
/// <author>Juergen Hoeller</author>

View File

@@ -351,7 +351,7 @@ namespace Spring.Messaging.Ems.Connections
}
if (LOG.IsDebugEnabled)
{
LOG.Debug("Creating cached NMS MessageConsumer for destination [" + destination + "]: " + consumer);
LOG.Debug("Creating cached EMS MessageConsumer for destination [" + destination + "]: " + consumer);
}
cachedConsumers[cacheKey] = consumer;
}

View File

@@ -42,7 +42,7 @@ namespace Spring.Messaging.Ems.Connections
/// <para>
/// NOTE: This ConnectionFactory requires explicit closing of all Sessions
/// obtained from its shared Connection. This is the usual recommendation for
/// native NMS access code anyway. However, with this ConnectionFactory, its use
/// native EMS access code anyway. However, with this ConnectionFactory, its use
/// is mandatory in order to actually allow for Session reuse.
/// </para>
/// <para>
@@ -143,7 +143,7 @@ namespace Spring.Messaging.Ems.Connections
/// <summary>
/// Gets or sets a value indicating whether o cache JMS MessageConsumers per
/// NMS Session instance.
/// EMS Session instance.
/// </summary>
/// <remarks>
/// Mmore specifically: one MessageConsumer per Destination, selector String
@@ -192,7 +192,7 @@ namespace Spring.Messaging.Ems.Connections
}
catch (Exception ex)
{
LOG.Trace("Could not close cached NMS Session", ex);
LOG.Trace("Could not close cached EMS Session", ex);
}
}
}

View File

@@ -164,7 +164,7 @@ namespace Spring.Messaging.Ems.Connections
/// <summary>
/// Gets or sets a value indicating whether the single Connection
/// should be reset (to be subsequently renewed) when a NMSException
/// should be reset (to be subsequently renewed) when a EMSException
/// is reported by the underlying Connection.
/// </summary>
/// <remarks>
@@ -441,7 +441,7 @@ namespace Spring.Messaging.Ems.Connections
PrepareConnection(this.target);
if (LOG.IsDebugEnabled)
{
LOG.Info("Established shared NMS Connection: " + this.target);
LOG.Info("Established shared EMS Connection: " + this.target);
}
this.connection = GetSharedConnection(target);
}
@@ -462,7 +462,7 @@ namespace Spring.Messaging.Ems.Connections
/// Can be overridden in subclasses.
/// </summary>
/// <param name="con">The Connection to prepare.</param>
/// <exception cref="EMSException">if thrown by any NMS API methods.</exception>
/// <exception cref="EMSException">if thrown by any EMS API methods.</exception>
protected virtual void PrepareConnection(IConnection con)
{
if (ClientId != null)
@@ -511,7 +511,7 @@ namespace Spring.Messaging.Ems.Connections
{
if (LOG.IsDebugEnabled)
{
LOG.Debug("Closing shared NMS Connection: " + this.target);
LOG.Debug("Closing shared EMS Connection: " + this.target);
}
try
{
@@ -528,7 +528,7 @@ namespace Spring.Messaging.Ems.Connections
}
} catch (Exception ex)
{
LOG.Warn("Could not close shared NMS connection.", ex);
LOG.Warn("Could not close shared EMS connection.", ex);
}
}
@@ -630,7 +630,7 @@ namespace Spring.Messaging.Ems.Connections
}
/// <summary>
/// Add information to show this is a shared NMS connection
/// Add information to show this is a shared EMS connection
/// </summary>
/// <returns>Description of connection wrapper</returns>
public override string ToString()

View File

@@ -1450,7 +1450,7 @@ namespace Spring.Messaging.Ems.Core
Destination destination = DefaultDestination;
if (!(destination is Queue))
{
throw new InvalidOperationException("defaultDestination does not correspond to a Queue. Check configuration of NmsTemplate.");
throw new InvalidOperationException("defaultDestination does not correspond to a Queue. Check configuration of EmsTemplate.");
}
return BrowseWithDelegate((Queue)destination, action);
}
@@ -1499,7 +1499,7 @@ namespace Spring.Messaging.Ems.Core
Destination destination = DefaultDestination;
if (!(destination is Queue))
{
throw new InvalidOperationException("defaultDestination does not correspond to a Queue. Check configuration of NmsTemplate.");
throw new InvalidOperationException("defaultDestination does not correspond to a Queue. Check configuration of EmsTemplate.");
}
return BrowseSelectedWithDelegate((Queue)destination, messageSelector, action);
}

View File

@@ -325,7 +325,7 @@ namespace Spring.Messaging.Ems.Listener
{
if (consumers != null)
{
logger.Debug("Closing NMS MessageConsumers");
logger.Debug("Closing EMS MessageConsumers");
foreach (IMessageConsumer messageConsumer in consumers)
{
EmsUtils.CloseMessageConsumer(messageConsumer);
@@ -333,7 +333,7 @@ namespace Spring.Messaging.Ems.Listener
}
if (sessions != null)
{
logger.Debug("Closing NMS Sessions");
logger.Debug("Closing EMS Sessions");
foreach (ISession session in sessions)
{
EmsUtils.CloseSession(session);

View File

@@ -31,13 +31,13 @@ namespace Spring.Messaging.Ems.Support.Converter
}
/// <summary>
/// Convert a .NET object to a NMS Message using the supplied session
/// Convert a .NET object to a EMS Message using the supplied session
/// to create the message object.
/// </summary>
/// <param name="objectToConvert">the object to convert</param>
/// <param name="session">the Session to use for creating a NMS Message</param>
/// <returns>the NMS Message</returns>
/// <throws>NMSException if thrown by NMS API methods </throws>
/// <param name="session">the Session to use for creating a EMS Message</param>
/// <returns>the EMS Message</returns>
/// <throws>EMSException if thrown by EMS API methods </throws>
/// <throws>MessageConversionException in case of conversion failure </throws>
public Message ToMessage(object objectToConvert, ISession session)
{
@@ -97,7 +97,7 @@ namespace Spring.Messaging.Ems.Support.Converter
}
/// <summary>
/// Convert from a NMS Message to a .NET object.
/// Convert from a EMS Message to a .NET object.
/// </summary>
/// <param name="messageToConvert">the message to convert</param>
/// <returns>the converted .NET object</returns>

View File

@@ -60,14 +60,18 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Messaging\Ems\Common\CertificateStoreConfig.cs" />
<Compile Include="Messaging\Ems\Common\EmsConnection.cs" />
<Compile Include="Messaging\Ems\Common\EmsConnectionFactory.cs" />
<Compile Include="Messaging\Ems\Common\EmsMessageConsumer.cs" />
<Compile Include="Messaging\Ems\Common\EmsMessageProducer.cs" />
<Compile Include="Messaging\Ems\Common\EmsSession.cs" />
<Compile Include="Messaging\Ems\Common\EmsSSLFileStoreInfo.cs" />
<Compile Include="Messaging\Ems\Common\EmsSSLSystemStoreInfo.cs" />
<Compile Include="Messaging\Ems\Common\EmsTopicSubscriber.cs" />
<Compile Include="Messaging\Ems\Common\IConnection.cs" />
<Compile Include="Messaging\Ems\Common\IConnectionFactory.cs" />
<Compile Include="Messaging\Ems\Common\IEmsSSLStoreType.cs" />
<Compile Include="Messaging\Ems\Common\IMessageConsumer.cs" />
<Compile Include="Messaging\Ems\Common\IMessageProducer.cs" />
<Compile Include="Messaging\Ems\Common\ISession.cs" />