Skip to content

Instantly share code, notes, and snippets.

@muhdkhokhar
Created August 6, 2022 20:42
Show Gist options
  • Save muhdkhokhar/aa2f358a421908deca5846af98966863 to your computer and use it in GitHub Desktop.
Save muhdkhokhar/aa2f358a421908deca5846af98966863 to your computer and use it in GitHub Desktop.
package com.example.demolistener;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;
import java.util.List;
import java.util.Map;
@SpringBootTest
class DemolistenerApplicationTests {
@Autowired
private JdbcTemplate jdbcTemplate;
@Test
void contextLoads() {
System.out.println(jdbcTemplate.queryForList("select * from auditlog"));
while(true){
List<Map<String, Object>> maps =
jdbcTemplate.queryForList(" WAITFOR (\n" +
" RECEIVE TOP(1) message_type_name, \n" +
" CAST(message_body AS varchar(max)), \n" +
" conversation_handle\n" +
" FROM dbo.TestQueue )");
System.out.println("========================");
System.out.println(maps);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment