Class AsyncSipListener
java.lang.Object
io.github.lunasaw.sip.common.transmit.AbstractSipListener
io.github.lunasaw.sip.common.transmit.AsyncSipListener
- All Implemented Interfaces:
EventListener,javax.sip.SipListener
- Direct Known Subclasses:
DefaultSipListener,TransactionAwareAsyncSipListener
异步SIP监听器
继承AbstractSipListener,提供异步消息处理能力
使用本地创建的默认线程池实现高性能消息处理
- Author:
- luna
-
Field Summary
Fields inherited from class io.github.lunasaw.sip.common.transmit.AbstractSipListener
REQUEST_PROCESSOR_MAP, RESPONSE_PROCESSOR_MAP, sipMetrics, TIMEOUT_PROCESSOR_MAP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor创建默认线程池 使用本地创建的线程池,不依赖Spring注入 注意:方法为protected以支持测试时通过反射调用(CGLIB代理需要)voiddestroy()销毁线程池资源 在应用关闭时调用,确保资源正确释放获取异步监听器统计信息voidprocessDialogTerminated(javax.sip.DialogTerminatedEvent dialogTerminatedEvent) 异步处理DialogTerminatedEvent事件 重写父类方法,提供异步处理能力voidprocessIOException(javax.sip.IOExceptionEvent exceptionEvent) 异步处理IOExceptionEvent事件 重写父类方法,提供异步处理能力voidprocessRequest(javax.sip.RequestEvent requestEvent) 异步处理RequestEvent事件 重写父类方法,提供异步处理能力voidprocessResponse(javax.sip.ResponseEvent responseEvent) 异步处理ResponseEvent事件 重写父类方法,提供异步处理能力voidprocessTimeout(javax.sip.TimeoutEvent timeoutEvent) 异步处理TimeoutEvent事件 重写父类方法,提供异步处理能力voidprocessTransactionTerminated(javax.sip.TransactionTerminatedEvent timeoutEvent) 异步处理TransactionTerminatedEvent事件 重写父类方法,提供异步处理能力Methods inherited from class io.github.lunasaw.sip.common.transmit.AbstractSipListener
addRequestProcessor, addResponseProcessor, addTimeoutProcessor, getRequestProcessors, getResponseProcessors, getTimeoutProcessors, handleIOException, handleRequestException, handleResponseException, handleUnsupportedRequest, removeRequestProcessor, removeResponseProcessor, removeTimeoutProcessor, shouldCreateTransaction
-
Constructor Details
-
AsyncSipListener
public AsyncSipListener()
-
-
Method Details
-
createDefaultThreadPool
protected org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor createDefaultThreadPool()创建默认线程池 使用本地创建的线程池,不依赖Spring注入 注意:方法为protected以支持测试时通过反射调用(CGLIB代理需要)- Returns:
- 默认线程池
-
processRequest
public void processRequest(javax.sip.RequestEvent requestEvent) 异步处理RequestEvent事件 重写父类方法,提供异步处理能力- Specified by:
processRequestin interfacejavax.sip.SipListener- Overrides:
processRequestin classAbstractSipListener- Parameters:
requestEvent- RequestEvent事件
-
processResponse
@Async("sipMessageProcessor") public void processResponse(javax.sip.ResponseEvent responseEvent) 异步处理ResponseEvent事件 重写父类方法,提供异步处理能力- Specified by:
processResponsein interfacejavax.sip.SipListener- Overrides:
processResponsein classAbstractSipListener- Parameters:
responseEvent- ResponseEvent事件
-
processTimeout
@Async("sipMessageProcessor") public void processTimeout(javax.sip.TimeoutEvent timeoutEvent) 异步处理TimeoutEvent事件 重写父类方法,提供异步处理能力- Specified by:
processTimeoutin interfacejavax.sip.SipListener- Overrides:
processTimeoutin classAbstractSipListener- Parameters:
timeoutEvent- TimeoutEvent事件
-
processIOException
@Async("sipMessageProcessor") public void processIOException(javax.sip.IOExceptionEvent exceptionEvent) 异步处理IOExceptionEvent事件 重写父类方法,提供异步处理能力- Specified by:
processIOExceptionin interfacejavax.sip.SipListener- Overrides:
processIOExceptionin classAbstractSipListener- Parameters:
exceptionEvent- IOExceptionEvent事件
-
processTransactionTerminated
@Async("sipMessageProcessor") public void processTransactionTerminated(javax.sip.TransactionTerminatedEvent timeoutEvent) 异步处理TransactionTerminatedEvent事件 重写父类方法,提供异步处理能力- Specified by:
processTransactionTerminatedin interfacejavax.sip.SipListener- Overrides:
processTransactionTerminatedin classAbstractSipListener- Parameters:
timeoutEvent- TransactionTerminatedEvent事件
-
processDialogTerminated
@Async("sipMessageProcessor") public void processDialogTerminated(javax.sip.DialogTerminatedEvent dialogTerminatedEvent) 异步处理DialogTerminatedEvent事件 重写父类方法,提供异步处理能力- Specified by:
processDialogTerminatedin interfacejavax.sip.SipListener- Overrides:
processDialogTerminatedin classAbstractSipListener- Parameters:
dialogTerminatedEvent- DialogTerminatedEvent事件
-
getProcessorStats
获取异步监听器统计信息- Overrides:
getProcessorStatsin classAbstractSipListener- Returns:
- 统计信息
-
destroy
public void destroy()销毁线程池资源 在应用关闭时调用,确保资源正确释放
-