apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From PramodSSImmaneni <...@git.apache.org>
Subject [GitHub] apex-malhar pull request #347: APEXMALHAR-2156 changes
Date Mon, 01 Aug 2016 14:53:42 GMT
Github user PramodSSImmaneni commented on a diff in the pull request:

    https://github.com/apache/apex-malhar/pull/347#discussion_r72991746
  
    --- Diff: library/src/main/java/com/datatorrent/lib/io/jms/JMSBase.java ---
    @@ -76,18 +76,52 @@
       private transient Session session;
       private transient Destination destination;
     
    -  private String connectionFactoryClass;
    -  private Map<String, String> connectionFactoryProperties = Maps.newHashMap();
    +  private ConnectionFactoryBuilder connectionFactoryBuilder = new DefaultConnectionFactoryBuilder();
       private String ackMode = "CLIENT_ACKNOWLEDGE";
    -  private String clientId = "TestClient";
    -  private String subject = "TEST.FOO";
    +  private String clientId;
    +  private String subject;
       private int batch = 10;
       private int messageSize = 255;
       private boolean durable = false;
       private boolean topic = false;
       private boolean verbose = false;
       protected boolean transacted = true;
     
    +  public abstract static class ConnectionFactoryBuilder
    +  {
    +    protected Map<String, String> connectionFactoryProperties = Maps.newHashMap();
    +
    +    public Map<String, String> getConnectionFactoryProperties()
    +    {
    +      return connectionFactoryProperties;
    +    }
    +
    +    public void setConnectionFactoryProperties(Map<String, String> connectionFactoryProperties)
    +    {
    +      this.connectionFactoryProperties = connectionFactoryProperties;
    +    }
    +
    +    public abstract ConnectionFactory buildConnectionFactory();
    +  }
    +
    +  public static class DefaultConnectionFactoryBuilder extends ConnectionFactoryBuilder
    +  {
    +
    +    @Override
    +    public ConnectionFactory buildConnectionFactory()
    +    {
    +      ConnectionFactory cf;
    +      try {
    +        cf = new org.apache.activemq.ActiveMQConnectionFactory();
    +        BeanUtils.populate(cf, super.connectionFactoryProperties);
    +        logger.debug("creation successful.");
    +        return cf;
    +      } catch (Exception e) {
    +        throw new RuntimeException("Failed to create connection factory.", e);
    --- End diff --
    
    DTThrowabled.rethrow() or throw Throwables.propagate so you are not wrapping the exception
if it is already a RuntimeException


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message