001/* 002 * Copyright (c) 2009 The openGion Project. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 013 * either express or implied. See the License for the specific language 014 * governing permissions and limitations under the License. 015 */ 016package org.opengion.fukurou.queue; 017 018import javax.jms.MessageListener; 019 020/** 021 * キュー受信クラス用インタフェース 022 * キュー受信処理のインタフェースです。 023 * MQとSQSのメッセージ受信に対応しています。 024 * 025 * @og.group メッセージ連携 026 * 027 * @og.rev 5.10.15.2 (2019/09/20) 新規作成 028 * 029 * @version 5 030 * @author oota 031 * @since JDK7 032 */ 033public interface QueueReceive { 034 035 /** 036 * 接続処理 037 * メッセージキューサーバに接続します。 038 * 039 * @param jmsServer jsmサーバ 040 * @param sqsAccessKey sqs用awsアクセスキー 041 * @param sqsSecretKey sqs用awsシークレットキー 042 */ 043 void connect(final String jmsServer, final String sqsAccessKey, final String sqsSecretKey); 044 045 /** 046 * 受信処理 047 * 受信処理を行います。 048 * 049 * @param queueName キュー名 050 * @return キュー情報格納クラス 051 */ 052 QueueInfo receive(final String queueName); 053 054 /** 055 * リスナーの設定 056 * 指定キュー名に対して、 057 * メッセージキュー受信時に処理を行う、 058 * メッセージリスナーを設定します。 059 * 060 * @param queueName キュー名 061 * @param listener メッセージリスナー 062 */ 063 void setListener(final String queueName, MessageListener listener); 064 065 /** 066 * リスナーの終了 067 * リスナーの終了処理を行います。 068 */ 069 void closeListener(); 070 071 /** 072 * クローズ処理 073 * MQ:受信リスナーの解除。 074 * SQS:クローズ処理はありません。 075 */ 076 void close(); 077 078 /** 079 * バッチフラグの設定 080 * バッチ処理として行う用の、 081 * バッチフラグを設定します。 082 * 083 * @param batchFlg バッチフラグ 084 */ 085 void setBatchFlg(final Boolean batchFlg); 086}