Annotation Type Subscribe


  • @Target(METHOD)
    @Retention(RUNTIME)
    @Documented
    public @interface Subscribe
    Subscribe to the "value", or topic. This annotation will create a Broadcaster with the value as ID, and suspend the underlying connection. This annotation does the same as Suspend, but create the Broadcaster automatically from the value.

    That annotation doesn't allow configuring the Suspend.outputComments() value. The default value is set to false. If you want to support http-streaming, make sure your client set the HeaderConfig.X_ATMOSPHERE_TRANSPORT header to "streaming".

    Author:
    Jeanfrancois Arcand
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      java.lang.String value
      The value that will be used to create or lookup a Broadcaster
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.Class<? extends org.atmosphere.cpr.AtmosphereResourceEventListener>[] listeners
      Add AtmosphereResourceEventListener to the broadcast operation.
      int timeout
      The timeout in millseconds before the connection is resumed.
      boolean writeEntity
      Write the returned entity back to the calling connection.
    • Element Detail

      • value

        java.lang.String value
        The value that will be used to create or lookup a Broadcaster
        Returns:
        The value that will be used to create or lookup a Broadcaster
      • listeners

        java.lang.Class<? extends org.atmosphere.cpr.AtmosphereResourceEventListener>[] listeners
        Add AtmosphereResourceEventListener to the broadcast operation.
        Default:
        {}
      • writeEntity

        boolean writeEntity
        Write the returned entity back to the calling connection. Default is false.
        Returns:
        true if the entity needs to be written back to the calling connection.
        Default:
        true
      • timeout

        int timeout
        The timeout in millseconds before the connection is resumed. Default is 30 seconds
        Returns:
        The timeout before the connection is resumed. Default is 30 seconds
        Default:
        30000