org.apache.cayenne.event

## Class JavaGroupsBridge

- java.lang.Object
- - org.apache.cayenne.event.EventBridge
  - - org.apache.cayenne.event.JavaGroupsBridge

- All Implemented Interfaces:
    EventListener

      public class JavaGroupsBridge
      extends EventBridge

  Implementation of EventBridge that passes and receives events via JavaGroups communication software.
  Since:
    1.1

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected PullPushAdapter` | `adapter`
    `protected Channel` | `channel`
    `protected String` | `configURL`
    `protected String` | `multicastAddress`
    `protected String` | `multicastPort`
    `protected byte[]` | `state`

    - ### Fields inherited from class org.apache.cayenne.event.EventBridge

      `eventManager, externalEventSource, externalSubject, localSubjects, mode, RECEIVE_EXTERNAL, RECEIVE_LOCAL, RECEIVE_LOCAL_EXTERNAL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JavaGroupsBridge(Collection<EventSubject> localSubjects, String externalSubject)`
    `JavaGroupsBridge(EventSubject localSubject, String externalSubject)` Creates new instance of JavaGroupsBridge.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected String` | `buildConfigString()` Creates JavaGroups configuration String, using preconfigured multicast port and address.
    `protected Serializable` | `eventToMessageObject(CayenneEvent event)` Converts CayenneEvent to a serializable object that will be sent via JMS.
    `String` | `getConfigURL()`
    `String` | `getMulticastAddress()`
    `String` | `getMulticastPort()`
    `byte[]` | `getState()`
    `protected CayenneEvent` | `messageObjectToEvent(Serializable object)` Converts a Serializable instance to CayenneEvent.
    `void` | `receive(Message message)` Implementation of org.javagroups.MessageListener - a callback method to process incoming messages.
    `protected void` | `sendExternalEvent(CayenneEvent localEvent)` Sends a Cayenne event over the transport supported by this bridge.
    `void` | `setConfigURL(String configURL)`
    `void` | `setMulticastAddress(String multicastAddress)`
    `void` | `setMulticastPort(String multicastPort)`
    `void` | `setState(byte[] state)`
    `protected void` | `shutdownExternal()` Shuts down the external interface of the EventBridge, cleaning up and releasing any resources used to communicate external events.
    `protected void` | `startupExternal()` Starts an external interface of the EventBridge.

    - ### Methods inherited from class org.apache.cayenne.event.EventBridge

      `convertToExternalSubject, getEventManager, getExternalEventSource, getExternalSubject, getLocalSubjects, isRunning, onExternalEvent, receivesExternalEvents, receivesLocalEvents, shutdown, startup, startup, startup`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### state

          protected byte[] state

    - #### channel

          protected Channel channel

    - #### adapter

          protected PullPushAdapter adapter

    - #### multicastAddress

          protected String multicastAddress

    - #### multicastPort

          protected String multicastPort

    - #### configURL

          protected String configURL

  - ### Constructor Detail

    - #### JavaGroupsBridge

          public JavaGroupsBridge(EventSubject localSubject,
                                  String externalSubject)

      Creates new instance of JavaGroupsBridge.

    - #### JavaGroupsBridge

          public JavaGroupsBridge(Collection<EventSubject> localSubjects,
                                  String externalSubject)

      Since:
        1.2

  - ### Method Detail

    - #### getConfigURL

          public String getConfigURL()

    - #### setConfigURL

          public void setConfigURL(String configURL)

    - #### getMulticastAddress

          public String getMulticastAddress()

    - #### setMulticastAddress

          public void setMulticastAddress(String multicastAddress)

    - #### getMulticastPort

          public String getMulticastPort()

    - #### setMulticastPort

          public void setMulticastPort(String multicastPort)

    - #### getState

          public byte[] getState()

    - #### setState

          public void setState(byte[] state)

    - #### receive

          public void receive(Message message)

      Implementation of org.javagroups.MessageListener - a callback method to process incoming messages.

    - #### startupExternal

          protected void startupExternal()
                                  throws Exception

      Description copied from class: `EventBridge`
      Starts an external interface of the EventBridge.
      Specified by:
        `startupExternal` in class `EventBridge`
      Throws:
        `Exception`

    - #### buildConfigString

          protected String buildConfigString()

      Creates JavaGroups configuration String, using preconfigured multicast port and address.

    - #### shutdownExternal

          protected void shutdownExternal()
                                   throws Exception

      Description copied from class: `EventBridge`
      Shuts down the external interface of the EventBridge, cleaning up and releasing any resources used to communicate external events.
      Specified by:
        `shutdownExternal` in class `EventBridge`
      Throws:
        `Exception`

    - #### sendExternalEvent

          protected void sendExternalEvent(CayenneEvent localEvent)
                                    throws Exception

      Description copied from class: `EventBridge`
      Sends a Cayenne event over the transport supported by this bridge.
      Specified by:
        `sendExternalEvent` in class `EventBridge`
      Throws:
        `Exception`

    - #### eventToMessageObject

          protected Serializable eventToMessageObject(CayenneEvent event)
                                               throws Exception

      Converts CayenneEvent to a serializable object that will be sent via JMS. Default implementation simply returns the event, but subclasses can customize this behavior.
      Throws:
        `Exception`

    - #### messageObjectToEvent

          protected CayenneEvent messageObjectToEvent(Serializable object)
                                               throws Exception

      Converts a Serializable instance to CayenneEvent. Returns null if the object is not supported. Default implementation simply tries to cast the object to CayenneEvent, but subclasses can customize this behavior.
      Throws:
        `Exception`

Copyright © 2001–2018 Apache Cayenne. All rights reserved.