// Path: examples/src/main/java/fixio/examples/common/AbstractQuoteStreamingWorker.java
// public abstract class AbstractQuoteStreamingWorker implements Runnable {
// 
//     private static final int BUFFER_LENGTH = 32;
// 
//     private final BlockingQueue<Quote> quoteQueue;
// 
//     public AbstractQuoteStreamingWorker(BlockingQueue<Quote> quoteQueue) {
//         this.quoteQueue = quoteQueue;
//     }
// 
//     protected abstract void sendQuotes(List<Quote> buffer);
// 
//     @Override
//     public void run() {
//         final List<Quote> buffer = new ArrayList<>(BUFFER_LENGTH);
//         //noinspection InfiniteLoopStatement
//         while (true) {
//             quoteQueue.drainTo(buffer, BUFFER_LENGTH);
//             sendQuotes(buffer);
//             buffer.clear();
//         }
//     }
// 
// }
// 
// Path: examples/src/main/java/fixio/examples/common/Quote.java
// public class Quote {
// 
//     private final double bid;
//     private final double offer;
// 
//     public Quote(double bid, double offer) {
//         this.bid = bid;
//         this.offer = offer;
//     }
// 
//     public double getBid() {
//         return bid;
//     }
// 
//     public double getOffer() {
//         return offer;
//     }
// }


import fixio.examples.common.AbstractQuoteStreamingWorker;
import fixio.examples.common.Quote;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import quickfix.Application;
import quickfix.DoubleField;
import quickfix.FieldNotFound;
import quickfix.Message;
import quickfix.Session;
import quickfix.SessionID;
import quickfix.SessionNotFound;
import quickfix.field.MktBidPx;
import quickfix.field.MktOfferPx;
import quickfix.field.MsgType;
import quickfix.field.QuoteReqID;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
/*
 * Copyright 2014 The FIX.io Project
 *
 * The FIX.io Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package fixio.examples.quickfix;



public class QuickFixStreamingApp implements Application {
    private static final Logger LOGGER = LoggerFactory.getLogger(QuickFixStreamingApp.class);
    private static final MsgType QUOTE_MSG_TYPE = new MsgType(MsgType.QUOTE);
    private final Map<String, SessionID> subscriptions = new ConcurrentHashMap<>();

// Path: examples/src/main/java/fixio/examples/common/AbstractQuoteStreamingWorker.java
// public abstract class AbstractQuoteStreamingWorker implements Runnable {
// 
//     private static final int BUFFER_LENGTH = 32;
// 
//     private final BlockingQueue<Quote> quoteQueue;
// 
//     public AbstractQuoteStreamingWorker(BlockingQueue<Quote> quoteQueue) {
//         this.quoteQueue = quoteQueue;
//     }
// 
//     protected abstract void sendQuotes(List<Quote> buffer);
// 
//     @Override
//     public void run() {
//         final List<Quote> buffer = new ArrayList<>(BUFFER_LENGTH);
//         //noinspection InfiniteLoopStatement
//         while (true) {
//             quoteQueue.drainTo(buffer, BUFFER_LENGTH);
//             sendQuotes(buffer);
//             buffer.clear();
//         }
//     }
// 
// }
// 
// Path: examples/src/main/java/fixio/examples/common/Quote.java
// public class Quote {
// 
//     private final double bid;
//     private final double offer;
// 
//     public Quote(double bid, double offer) {
//         this.bid = bid;
//         this.offer = offer;
//     }
// 
//     public double getBid() {
//         return bid;
//     }
// 
//     public double getOffer() {
//         return offer;
//     }
// }


// Path: examples/src/main/java/fixio/examples/quickfix/QuickFixStreamingApp.java
import fixio.examples.common.AbstractQuoteStreamingWorker;
import fixio.examples.common.Quote;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import quickfix.Application;
import quickfix.DoubleField;
import quickfix.FieldNotFound;
import quickfix.Message;
import quickfix.Session;
import quickfix.SessionID;
import quickfix.SessionNotFound;
import quickfix.field.MktBidPx;
import quickfix.field.MktOfferPx;
import quickfix.field.MsgType;
import quickfix.field.QuoteReqID;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;

/*
 * Copyright 2014 The FIX.io Project
 *
 * The FIX.io Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package fixio.examples.quickfix;



public class QuickFixStreamingApp implements Application {
    private static final Logger LOGGER = LoggerFactory.getLogger(QuickFixStreamingApp.class);
    private static final MsgType QUOTE_MSG_TYPE = new MsgType(MsgType.QUOTE);
    private final Map<String, SessionID> subscriptions = new ConcurrentHashMap<>();

    public QuickFixStreamingApp(BlockingQueue<Quote> quoteQueue) {