@ Override public void notifySubscribers ( final List < ? extends Subscriber > subscribers , final SyndFeed value , final SubscriptionSummaryCallback callback ) { String mimeType = null ; if ( value . getFeedType ( ) . startsWith ( "rss" ) ) { mimeType = "application/rss+xml" ; } else { mimeType = "application/atom+xml" ; } final SyndFeedOutput output = new SyndFeedOutput ( ) ; final ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; try { output . output ( value , new OutputStreamWriter ( baos ) ) ; baos . close ( ) ; } catch ( final IOException ex ) { LOG . error ( "Unable to output the feed" , ex ) ; throw new RuntimeException ( "Unable to output the feed." , ex ) ; } catch ( final FeedException ex ) { LOG . error ( "Unable to output the feed" , ex ) ; throw new RuntimeException ( "Unable to output the feed." , ex ) ; } final byte [ ] payload = baos . toByteArray ( ) ; for ( final Subscriber s : subscribers ) { final Notification not = new Notification ( ) ; not . callback = callback ; not . lastRun = 0 ; not . mimeType = mimeType ; not . payload = payload ; not . retryCount = 0 ; not . subscriber = s ; enqueueNotification ( not ) ; } }
This method will serialize the synd feed and build Notifications for the implementation class to handle .