Skip to content

Commit

Permalink
Component doc
Browse files Browse the repository at this point in the history
  • Loading branch information
davsclaus committed Apr 24, 2015
1 parent 429b354 commit 9d9f2b3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 40 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public CamelJGroupsReceiver(JGroupsEndpoint endpoint, Processor processor) {


@Override @Override
public void viewAccepted(View view) { public void viewAccepted(View view) {
if (endpoint.isResolvedEnableViewMessages()) { if (endpoint.isEnableViewMessages()) {
Exchange exchange = endpoint.createExchange(view); Exchange exchange = endpoint.createExchange(view);
try { try {
LOG.debug("Processing view: {}", view); LOG.debug("Processing view: {}", view);
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@
public class JGroupsComponent extends UriEndpointComponent { public class JGroupsComponent extends UriEndpointComponent {


private Channel channel; private Channel channel;

private String channelProperties; private String channelProperties;

private boolean enableViewMessages;
private Boolean enableViewMessages;


public JGroupsComponent() { public JGroupsComponent() {
super(JGroupsEndpoint.class); super(JGroupsEndpoint.class);
Expand All @@ -46,6 +44,9 @@ public Channel getChannel() {
return channel; return channel;
} }


/**
* Channel to use
*/
public void setChannel(Channel channel) { public void setChannel(Channel channel) {
this.channel = channel; this.channel = channel;
} }
Expand All @@ -54,15 +55,22 @@ public String getChannelProperties() {
return channelProperties; return channelProperties;
} }


/**
* Specifies configuration properties of the JChannel used by the endpoint.
*/
public void setChannelProperties(String channelProperties) { public void setChannelProperties(String channelProperties) {
this.channelProperties = channelProperties; this.channelProperties = channelProperties;
} }


public Boolean getEnableViewMessages() { public boolean isEnableViewMessages() {
return enableViewMessages; return enableViewMessages;
} }


public void setEnableViewMessages(Boolean enableViewMessages) { /**
* If set to true, the consumer endpoint will receive org.jgroups.View messages as well (not only org.jgroups.Message instances).
* By default only regular messages are consumed by the endpoint.
*/
public void setEnableViewMessages(boolean enableViewMessages) {
this.enableViewMessages = enableViewMessages; this.enableViewMessages = enableViewMessages;
} }


Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -39,33 +39,25 @@
public class JGroupsEndpoint extends DefaultEndpoint { public class JGroupsEndpoint extends DefaultEndpoint {


public static final String HEADER_JGROUPS_ORIGINAL_MESSAGE = "JGROUPS_ORIGINAL_MESSAGE"; public static final String HEADER_JGROUPS_ORIGINAL_MESSAGE = "JGROUPS_ORIGINAL_MESSAGE";

public static final String HEADER_JGROUPS_SRC = "JGROUPS_SRC"; public static final String HEADER_JGROUPS_SRC = "JGROUPS_SRC";

public static final String HEADER_JGROUPS_DEST = "JGROUPS_DEST"; public static final String HEADER_JGROUPS_DEST = "JGROUPS_DEST";

public static final String HEADER_JGROUPS_CHANNEL_ADDRESS = "JGROUPS_CHANNEL_ADDRESS"; public static final String HEADER_JGROUPS_CHANNEL_ADDRESS = "JGROUPS_CHANNEL_ADDRESS";


private static final Logger LOG = LoggerFactory.getLogger(JGroupsEndpoint.class); private static final Logger LOG = LoggerFactory.getLogger(JGroupsEndpoint.class);


private Channel channel;
private AtomicInteger connectCount = new AtomicInteger(0); private AtomicInteger connectCount = new AtomicInteger(0);


private Channel channel;
private Channel resolvedChannel; private Channel resolvedChannel;


@UriPath @Metadata(required = "true") @UriPath @Metadata(required = "true")
private String clusterName; private String clusterName;

@UriParam @UriParam
private String channelProperties; private String channelProperties;
@UriParam(label = "consumer")
private boolean enableViewMessages;


@UriParam public JGroupsEndpoint(String endpointUri, Component component, Channel channel, String clusterName, String channelProperties, boolean enableViewMessages) {
private Boolean enableViewMessages;

@UriParam
private boolean resolvedEnableViewMessages;

public JGroupsEndpoint(String endpointUri, Component component, Channel channel, String clusterName, String channelProperties, Boolean enableViewMessages) {
super(endpointUri, component); super(endpointUri, component);
this.channel = channel; this.channel = channel;
this.clusterName = clusterName; this.clusterName = clusterName;
Expand Down Expand Up @@ -114,7 +106,6 @@ public Exchange createExchange() {
protected void doStart() throws Exception { protected void doStart() throws Exception {
super.doStart(); super.doStart();
resolvedChannel = resolveChannel(); resolvedChannel = resolveChannel();
resolvedEnableViewMessages = resolveEnableViewMessages();
} }


@Override @Override
Expand Down Expand Up @@ -154,17 +145,13 @@ public void disconnect() {
} }
} }


private boolean resolveEnableViewMessages() {
if (enableViewMessages != null) {
resolvedEnableViewMessages = enableViewMessages;
}
return resolvedEnableViewMessages;
}

public Channel getChannel() { public Channel getChannel() {
return channel; return channel;
} }


/**
* The channel to use
*/
public void setChannel(Channel channel) { public void setChannel(Channel channel) {
this.channel = channel; this.channel = channel;
} }
Expand All @@ -173,6 +160,9 @@ public String getClusterName() {
return clusterName; return clusterName;
} }


/**
* The name of the JGroups cluster the component should connect to.
*/
public void setClusterName(String clusterName) { public void setClusterName(String clusterName) {
this.clusterName = clusterName; this.clusterName = clusterName;
} }
Expand All @@ -181,31 +171,27 @@ public String getChannelProperties() {
return channelProperties; return channelProperties;
} }


/**
* Specifies configuration properties of the JChannel used by the endpoint.
*/
public void setChannelProperties(String channelProperties) { public void setChannelProperties(String channelProperties) {
this.channelProperties = channelProperties; this.channelProperties = channelProperties;
} }


public Channel getResolvedChannel() { Channel getResolvedChannel() {
return resolvedChannel; return resolvedChannel;
} }


public void setResolvedChannel(Channel resolvedChannel) { public boolean isEnableViewMessages() {
this.resolvedChannel = resolvedChannel;
}

public Boolean getEnableViewMessages() {
return enableViewMessages; return enableViewMessages;
} }


public void setEnableViewMessages(Boolean enableViewMessages) { /**
* If set to true, the consumer endpoint will receive org.jgroups.View messages as well (not only org.jgroups.Message instances).
* By default only regular messages are consumed by the endpoint.
*/
public void setEnableViewMessages(boolean enableViewMessages) {
this.enableViewMessages = enableViewMessages; this.enableViewMessages = enableViewMessages;
} }


public boolean isResolvedEnableViewMessages() {
return resolvedEnableViewMessages;
}

public void setResolvedEnableViewMessages(boolean resolvedEnableViewMessages) {
this.resolvedEnableViewMessages = resolvedEnableViewMessages;
}
} }

0 comments on commit 9d9f2b3

Please sign in to comment.