You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by "Jean-Baptiste Onofré (JIRA)" <ji...@apache.org> on 2017/01/06 16:56:58 UTC

[jira] [Commented] (BEAM-870) JmsIO should be able to serialize the connection factory

    [ https://issues.apache.org/jira/browse/BEAM-870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15804988#comment-15804988 ] 

Jean-Baptiste Onofré commented on BEAM-870:
-------------------------------------------

Basically, the idea is to "force" the serialization of the {{ConnectionFactory}} using a wrapper like:

{code}
import java.io.Serializable;

public class SerializableWrapper<NotSerializableT> implements Serializable {
  private byte[] bytes;
  private volatile NotSerializableT actual;
  
  public SerializableWrapper(byte[] bytes) {
    this.bytes = bytes;
  }
  
  public NotSerializableT get() {
    if (actual == null) {
      synchronized(this) {
        if (actual == null) {
          actual = decode();
        }
      }
    }
    
    return actual;
  }
  
  private static <T> T decode() {
    //TODO: decode "bytes" into "actual" by coding the deserialization here, or use a coder.
  }
}
{code}

I started something like this on a branch.

> JmsIO should be able to serialize the connection factory
> --------------------------------------------------------
>
>                 Key: BEAM-870
>                 URL: https://issues.apache.org/jira/browse/BEAM-870
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-java-extensions
>            Reporter: Jean-Baptiste Onofré
>            Assignee: Jean-Baptiste Onofré
>
> Even if a JMS connection factory should be serializable (according to the specification), some brokers may be flaky there.
> Instead of directly taking a connection factory, the JmsIO should create a connection factory using a configuration (serializable).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)